RHEL/CentOS 6.0使用第三方軟體庫(EPEL與RPMForge、RPMFusion軟體庫)

來源:互聯網
上載者:User
RHEL/CentOS 5.5使用第三方軟體庫(EPEL與RPMForge、RPMFusion軟體庫)在 CentOS下運行yum install flash-plugin或yum install mplayer的時候,提示庫裡沒有找到這個軟體?為什麼會這樣?因為CentOS是RHEL編譯過來的,去掉了所有關於著作權問題的東西。因此,在沒有使 用第三方軟體庫的情況下,很多軟體無法用yum install來直接安裝。
EPEL(Extra Packages for Enterprise Linux )軟體庫提供為 EL4 及 EL5 重新編譯的 Fedora 組件。這個軟體庫在不替換系統組件方面下了功夫。在某些情況下它嘗試直接針對 CentOS 相容性的問題,但堅決否定軟體庫間的相容性是目標之一。當它與其它第三方軟體庫混合使用時,問題可能會出現。故此,當你使用 EPEL 時,尤其是當你亦會運用其它件庫的組件時,請確保你使用 yum 的 Priorities 外掛程式。
RPMForge庫現在已經擁有超過10000種的CentOS的軟體包,被CentOS社區認為是最安全也是最穩定的一個第三方軟體庫。
下面,偶就來講解下如何使用EPEL與RPMForge、RPMFusion軟體倉庫:
一、安裝yum-priorities外掛程式。
這個外掛程式是用來設定yum在調用軟體源時的順序的。因為官方提供的軟體源,都是比較穩定和被推薦使用的。因此,官方源的順序要高於第三方源的順序。如何保證這個順序,就需要安裝yum-priorities這外掛程式了。
[root@CentOS ~]# yum install yum-priorities #安裝yum-priorities
安裝完後需要設定/etc/yum.repos.d/ 目錄下的.repo相關檔案(如CentOS-Base.repo),在這些檔案中插入順序指令:priority=N (N為1到99的正整數,數值越小越優先)

一般的配置是這樣的:

[base], [addons], [updates], [extras] … priority=1
[CentOSplus],[contrib] … priority=2
其他第三的軟體源為:priority=N (推薦N>10)

如我的CentOS-Base.repo配置為:

# CentOS-Base.repo
#
# 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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=2
#contrib – packages by CentOS Users
[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-5
priority=2

二、下載與安裝相應EPEL的rpm檔案包
1,下載與安裝EPEL的rpm檔案包
32位系統

[root@CentOS ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm

64位系統

[root@CentOS ~]# rpm -ivh http://download.fedora.redhat.co ... ease-5-4.noarch.rpm

如果您不清楚您的系統核心,請使用 uname -a 命令來查看您的核心資訊。
2,匯入DAG的PGP Key
[root@CentOS ~]# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
3,設定/etc/yum.repos.d/epel.repo檔案中源的層級,就是添加priority=11這句。
如我的epel.repo檔案內容:

[epel]
name=Extra Packages for Enterprise Linux 5 – $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
priority=11
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 – $basearch – Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 5 – $basearch – Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

三、下載與安裝相應rpmforge的rpm檔案包
1,下載rpmforge的rpm檔案包
32位系統

[root@CentOS ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

或者直接用 rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm(省略以下步驟2-4)

64位系統

[root@CentOS ~]# wget http://packages.sw.be/rpmforge-r ... 1.el5.rf.x86_64.rpm

2,安裝DAG的PGP Key

[root@CentOS ~]# rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

3,驗證rpmforge的rpm檔案包

[root@CentOS ~]# rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm

4,安裝rpmforge的rpm檔案包

[root@CentOS ~]# rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm

5,設定/etc/yum.repos.d/rpmforge.repo檔案中源的層級,就是添加priority=12這句。
如我的rpmforge.repo檔案內容:

### Name: RPMforge RPM Repository for Red Hat Enterprise 5 – dag
### URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever – RPMforge.net – dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/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的rpm檔案包
(CentOS官方說這個軟體庫裡面的軟體穩定性不如rpmforge,選用!rpmfusion官方站:http://rpmfusion.org)

[root@CentOS ~]# rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-free-release-5-0.1.noarch.rpm
[root@CentOS ~]# rpm -Uvh http://download1.rpmfusion.org/n ... se-5-0.1.noarch.rpm

五、測試
1,測試升級
[root@CentOS ~]# yum check-update
輸出資訊應該會有以下兩行:
Loading “priorities” plugin

XX packages excluded due to repository priority protections
2,安裝下mplayer播放器試試,如果安裝成功了就沒有問題了。
[root@CentOS ~]# yum install mplayer

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.