Centos添加其他yum源

一、安装CentOS yum源优先级插件yum-priorities

yum install yum-priorities   #输入y安装

二、设置CentOS默认yum源的优先级为最高

cd  /etc/yum.repos.d/   #进入yum源目录

vi CentOS-Base.repo   #[base][updates][extras]组下面添加priority=1,在[centosplus][contrib]组下面添加priority=2    结果如下:

################################################################

[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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

priority=1

 

[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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

priority=1

 

[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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

priority=1

 

[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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

priority=2

 

[contrib]

name=CentOS-$releasever - Contrib

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

priority=2

###############################################################

 

 

备注:priority的优先级为199,设置为1即优先级最高,1-10为系统保留,第三方yum源的优先级从11-99

三、安装epel yum(转载自http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x 

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm



然后    vi    /etc/yum.repos.d/epel.repo   将其优先级设置为11

 

[epel]

name=Extra Packages for Enterprise Linux 6 - $basearch

#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

failovermethod=priority

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

priority=11



[epel-debuginfo]

name=Extra Packages for Enterprise Linux 6 - $basearch - Debug

#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

gpgcheck=1

priority=11



[epel-source]

name=Extra Packages for Enterprise Linux 6 - $basearch - Source

#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

gpgcheck=1



priority=11

 

 

四:安装remi源:

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

导入key

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi

更改优先级: 

vi /etc/yum.repos.d/remi.repo 

如下将优先级设置为 12   

[remi]

name=Les RPM de remi pour Enterprise Linux 6 - $basearch

#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/

mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

priority=12



[remi-test]

name=Les RPM de remi en test pour Enterprise Linux 6 - $basearch

#baseurl=http://rpms.famillecollet.com/enterprise/6/test/$basearch/

mirrorlist=http://rpms.famillecollet.com/enterprise/6/test/mirror

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi



priority=12





[remi-debuginfo]

name=Les RPM de remi pour Enterprise Linux 6 - $basearch - debuginfo

baseurl=http://rpms.famillecollet.com/enterprise/6/debug-remi/$basearch/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi



[remi-test-debuginfo]

name=Les RPM de remi en test pour Enterprise Linux 6 - $basearch - debuginfo

baseurl=http://rpms.famillecollet.com/enterprise/6/debug-test/$basearch/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

priority=12

 

 

nux源

http://li.nux.ro/repos.html

posted @ 2014-01-20 19:40  jiahu  阅读(550)  评论(0编辑  收藏  举报