天天看點

為centos添加第三方源

  預設centos自帶的源少了很多好軟體,是以需要添加第三方源

一、安裝CentOS yum源優先級插件yum-priorities

yum install yum-plugin-priorities.noarch

二、設定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/

[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/

[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/

enabled=0

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/

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

備注:priority的優先級為1到99,設定為1即優先級最高,1-10為系統保留,第三方yum源的優先級從11-99

三、安裝epel yum源

    rpm -ivh  http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

    vi /etc/yum.repos.d/epel.repo   #修改epel yum源優先級,priority=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

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

priority=11

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

四、安裝rpmforge yum源

   wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

   wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

   rpm --import RPM-GPG-KEY.dag.txt

   rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

   vi  /etc/yum.repos.d/rpmforge.repo  #修改rpmforge yum源優先級,priority=12

[rpmforge]

name = RHEL $releasever - RPMforge.net - dag

baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge

mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge

#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge

enabled = 1

protect = 0

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

gpgcheck = 1

priority=12

五、安裝rpmfusion yum源

   rpm -ivh http://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm

   vi  /etc/yum.repos.d/rpmfusion-free-updates-testing.repo   #修改rpmfusion yum源優先級,priority=13

[rpmfusion-free-updates-testing]

name=RPM Fusion for EL 6 - Free - Test Updates

#baseurl=http://download1.rpmfusion.org/free/el/updates/testing/6/$basearch/

mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-testing-6&arch=$basearch

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6

priority=13

系統運維  www.osyunwei.com  溫馨提醒:qihang01原創内容©版權所有,轉載請注明出處及原文連結

六、安裝atomic yum源

    wget http://www.atomicorp.com/installers/atomic  #下載下傳

    sh ./atomic   #安裝

    vi  /etc/yum.repos.d/atomic.repo  #修改atomic yum源優先級,priority=14

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

[atomic]

name = CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.com

mirrorlist = http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch

#mirrorlist = http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomic

priority = 1

gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt

priority=14

七、更新yum軟體包

       yum check-update

本文轉自lustlost 51CTO部落格,原文連結:http://blog.51cto.com/lustlost/818451,如需轉載請自行聯系原作者