如何在CentOS 5/6上安裝EPEL源
EPEL 是什么?
EPEL (Extra Packages for Enterprise Linux,企業(yè)版Linux的額外軟件包) 是Fedora小組維護(hù)的一個軟件倉庫項目,為RHEL/CentOS提供他們默認(rèn)不提供的軟件包。這個源兼容RHEL及像CentOS和Scientific Linux這樣的衍生版本。
我們可以很容易地通過yum命令從EPEL源上獲取上萬個在CentOS自帶源上沒有的軟件。EPEL提供的軟件包大多基于其對應(yīng)的Fedora軟件包,不會與企業(yè)版Linux發(fā)行版本的軟件發(fā)生沖突或替換其文件。
更多關(guān)于EPEL 項目的細(xì)節(jié)可以到以下網(wǎng)站獲?。?a target="_blank">https://fedoraproject.org/wiki/EPEL
在文本中,我將展示在CentOS下如何安裝EPEL源。
提示 - RHEL/CentOS系統(tǒng)有許多第三方源,比較流行的比如RpmForge,RpmFusion,EPEL,Remi等等。
然而需要引起注意的是,如果系統(tǒng)添加了多個第三方源,可能會因此產(chǎn)生沖突——一個軟件包可以從多個源獲取,一些源會替換系統(tǒng)的基礎(chǔ)軟件包,從而可能會產(chǎn)生意想不到的錯誤。已知的就有Rpmforge與EPEL會產(chǎn)生沖突。
對于這些問題我們建議,調(diào)整源的優(yōu)先權(quán)或者有選擇性的安裝源,但是這需要復(fù)雜的操作,如果你不確定如何操作,我們推薦你只安裝一個第三方源。
在CentOS 上安裝EPEL
要想安裝EPEL,我們先要下載EPEL的rpm安裝包。
CentOS/RHEL下的6.x和5.x版本下載頁面如下:
http://download.fedoraproject.org/pub/epel/6/i386/repoview/epel-release.html
http://download.fedoraproject.org/pub/epel/5/i386/repoview/epel-release.html
以上網(wǎng)址可能會被重定向到特定的鏡像站而加快下載速度。這個頁面包含可以直接獲取到rpm包的下載鏈接。直接的下載鏈接如下:
http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
根據(jù)你的CentOS 版本來選擇正確的下載地址。
請注意EPEL 的安裝包是獨(dú)立編譯的,所以它可以安裝在32位和64位系統(tǒng)中。
1. 確認(rèn)你的CentOS 的版本
首先通過以下命令確認(rèn)你的CentOS 版本
- $ cat /etc/redhat-release
- CentOS release 6.4 (Final)
2. 下載EPEL 的rpm 安裝包
現(xiàn)在從上面的地址下載CentOS 版本所對應(yīng)的EPEL 的版本
- $ wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
3. 安裝EPEL
通過以下命令安裝EPEL 軟件包
- $ sudo rpm -ivh epel-release-6-8.noarch.rpm
或
- $ sudo rpm -ivh epel-release*
5. 檢查EPEL 源
安裝好EPEL 源后,用yum 命令來檢查是否添加到源列表
- # yum repolist
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- * base: mirrors.vonline.vn
- * epel: buaya.klas.or.id
- * extras: centos-hn.viettelidc.com.vn
- * updates: mirrors.fibo.vn
- repo id repo name status
- base CentOS-6 - Base 6,381
- epel Extra Packages for Enterprise Linux 6 - x86_64 10,023
- extras CentOS-6 - Extras 13
- nginx nginx repo 47
- updates CentOS-6 - Updates 1,555
- repolist: 18,019
EPEL已經(jīng)在repo 后列出,并且顯示提供了上萬個軟件包,所以EPEL 已經(jīng)安裝到你的CentOS了。
EPEL源的配置安裝到了 /etc/yum.repos.d/epel.repo 文件。
現(xiàn)在來試一下從EPEL 獲取軟件包
- $ sudo yum install htop
via: http://www.binarytides.com/setup-epel-repository-centos/