最开始的是这样的:
1 cd /etc/yum.repos.d/ 2 ls
显示如下内容:
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
开始添加新的源
一、安装CentOS yum源优先级插件yum-priorities
yum install yum-priorities
二、设置CentOS默认yum源的优先级为最高
1 cd /etc/yum.repos.d/ 2 vi CentOS-Base.repo
在[base]、[updates]、[extras]组下面添加priority=1,在[centosplus]、[contrib]组下面添加priority=2
备注:priority的优先级为1到99,设置为1即优先级最高,1-10为系统保留,第三方yum源的优先级从11-99
三、安装epel yum源
1 rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm 2 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 3 vi /etc/yum.repos.d/epel.repo
修改epel yum源优先级,priority=11
四、安装rpmforge yum源
1 wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm 2 wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt 3 rpm --import RPM-GPG-KEY.dag.txt 4 rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm 5 vi /etc/yum.repos.d/rpmforge.repo
修改rpmforge yum源优先级,priority=12
五、安装rpmfusion yum源
也许会提示错误,多试几次。
1 sudo rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm
Retrieving http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm
warning: /var/tmp/rpm-tmp.Gc2eET: Header V3 RSA/SHA256 Signature, key ID 849c449f: NOKEY
Preparing... ########################################### [100%]
1:rpmfusion-free-release ########################################### [100%]
1 sudo vim rpmfusion-free-updates.repo 2 sudo vim rpmfusion-free-updates-testing.repo
修改rpmfusion yum源优先级,priority=13
六、更新yum软件包
yum check-update