有次在使用CentOS系统的时候,我下了源码编译却加--enable-gui就出错,不加就过了,过了却没界面,只能听到声音,没办法,找几个rpm文件安装,明明已经安装了的文件却说需要它,最后,我终于寻找到了yum安装mplayer的方法。
首先yum install yum-priorities,yum-priorities插件可以为yum的源仓库指定优先级。如果安装包是用高优先级的源仓库安装的,那么这些包就不能用低优先级别的源仓库去更新。同样的,如果一个包可以从多个源仓库中下载安装,但指定了优先级别之后,这个包就会从最高优先级的源仓库安装。假如用户使用一个或者多个第三方源仓库,这些源仓库都会更新系统文件,有些更新甚至会潜在的危害你的的CentOS系统,这个时候,该插件就特别起作用了。
现在开始编辑 /etc/yum/pluginconf.d/priorities.conf文件,必须先确认其中有以下的设置:[main] enabled=1
然后编辑 /etc/yum.repos.d/,
如下:
- CentOS-Base.repo
- This file uses a new mirrorlist system developed by Lance Davis for CentOS.
- The mirror system uses the connecting IP address of the client and the
- update status of each mirror to pick mirrors that are updated to and
- geographically close to the client. You should use this for CentOS updates
- unless you are manually picking other mirrors.
- If the mirrorlist= does not work for you, as a fall back you can try the
- remarked out baseurl= line instead.
- [base]
- name=CentOS-$releasever - Base
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
- #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
- gpgcheck=1
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- priority=1
- #released updates
- [updates]
- name=CentOS-$releasever - Updates
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
- #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
- gpgcheck=1
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- priority=1
- #packages used/produced in the build but not released
- [addons]
- name=CentOS-$releasever - Addons
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&,汽车尾气达标;arch=$basearch&repo=addons
- #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
- gpgcheck=1
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- priority=1
- #additional packages that may be useful
- [extras]
- name=CentOS-$releasever - Extras
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
- #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
- gpgcheck=1
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- priority=1
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-$releasever - Plus
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
- #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
- priority=2
也就是每个仓库后面添加了个priority=x,通过上面的设定之后,Yum将不会从低优先级的源更新那些来自base和update仓库的的安装包。这里x必须取1到99之间的整数。CentOS系统仓库的默认优先级是99.序号最小的源仓库具有最高的优先级。同常,最好是为CentOS系统 base 和 update仓库选择非常高的优先级(毕竟是官方的嘛!),在上面的CentOS-Base.repo 文件里,CentOS base 和 update仓库都被指定了最高的优先级 (priority=1)。
下面CentOS系统开始安装mplayer:
安装RPMforge:
先下载rpmforge-release包,根据你的系统,从下面的链接中选择一个下载。
i386http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
x86_64 http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
安装DAG's GPG key
#rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
检查你下载的包
#rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm
装rpmforge包
#rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
运行了上述的命令后,将会向CentOS系统yum源仓库里加入一个配置文件,并且会导入合适的 GPG keys。此时,最好也设置RPMForge仓库的优先级。
用下面的命令检查更新
#yum check-update
最后就安装mplayer了
#yum install mplayer*
然后到这里下载两个编码包all-20071007.tar.bz2和windows-all-20071007.zip
http://www1.mplayerhq.hu/MPlayer/releases/codecs/
yum安装mplayer后编码包默认应安装在/usr/lib/codecs/中
- tar jxvf all-20071007.tar.bz2
- mv -f all-20071007/* /usr/lib/codecs/
- unzip windows-all-20071007.zip
- mkdir /usr/lib/win32
- mv window-all-20071007/* /usr/lib/win32
- ln -s /usr/lib/codecs /usr/lib/win32
再看看CentOS系统中应用程序的影音中已经出现了mplayer。启动mplayer就可以播放了,rmvb也一样被搞定。
【编辑推荐】