歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 讓CentOS6 yum源支持更多rpm包的升級(使用第三方軟件庫EPEL、RPMForge與RPMFusion)

讓CentOS6 yum源支持更多rpm包的升級(使用第三方軟件庫EPEL、RPMForge與RPMFusion)

日期:2017/2/28 14:28:33   编辑:Linux教程

在CentOS下運行yum install flash-plugin或yum install mplayer的時候,提示庫裡沒有找到這個軟件?為什麼會這樣?因為CentOS是RHEL編譯過來的,去掉了所有關於版權問題的東西。因此,在沒有使用第三方軟件庫的情況下,很多軟件無法用yum install來直接安裝。

EPEL(Extra Packages for Enterprise Linux)軟件庫提供為RHEL系列(4.x、5.x、6.x等等)重新編譯的Fedora組件。這個軟件庫在不替換系統組件方面下了功夫。在某些情況下它嘗試直接針對CentOS兼容性的問題,但堅決否定軟件庫間的兼容性是目標之一。當它與其它第三方軟件庫混合使用時,問題可能會出現。故此,當你使用EPEL時,尤其是當你亦會運用其它件庫的組件時,請確保你使用yum的Priorities插件。

RPMForge庫現在已經擁有超過10000種的CentOS的軟件包,被CentOS社區認為是最安全也是最穩定的一個第三方軟件庫。

RedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htm

RedHat 6.2 Linux修改yum源免費使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件說明 http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安裝yum(圖文) http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安裝及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm



下面講解下如何使用EPEL與RPMForge、RPMFusion軟件倉庫:

一、安裝yum-priorities插件。

這個插件是用來設置yum在調用軟件源時的順序的。因為官方提供的軟件源,都是比較穩定和被推薦使用的。因此,官方源的順序要高於第三方源的順序。如何保證這個順序,就需要安裝yum-priorities這插件了。

[root@CentOS ~]# yum install 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 6.0):
# 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-6
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-6
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-6
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-6
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-6
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-6
priority=2

二、下載與安裝相應EPEL的rpm文件包

1、下載與安裝EPEL的rpm文件包

32位系統
[root@CentOS ~]# rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

64位系統
[root@CentOS ~]# rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.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 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

[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

更多詳情見請繼續閱讀下一頁的精彩內容: http://www.linuxidc.com/Linux/2014-08/106024p2.htm

Copyright © Linux教程網 All Rights Reserved