在CentOS上安裝第三方軟件庫EPEL

Extra Packages for Enterprise Linux (EPEL)【企業版 Linux 附加軟件包(如下簡稱 EPEL)】是一個由特別興趣小組建立、維護並管理的,針對 紅帽企業版 Linux(RHEL)及其衍生髮行版(好比 CentOS、 Scientific Linux)的一個高質量附加軟件包項目。
EPEL 的軟件包一般不會與企業版Linux官方源中的軟件包發生衝突,或者互相替換文件。EPEL與Fedora項目基本一致,包含完整的構建系統、升級管理器、鏡像管理器等等。
EPEL 包含一個叫作epel-release的包,這個包包含了EPEL源的gpg密鑰和軟件源信息。您能夠經過yum安裝到您的企業版Linux發行版上。除了epel-release源,還有一個叫作epel-testing的源,這個源包含最新的測試軟件包,其版本很新可是安裝有風險,請自行斟酌。
注意: 有些第三方軟件源須要 EPEL 的'epel-testing'源來安裝依賴組件,請務必在系統設置中啓用本源。 這裏 有相關的開啓教程。(相關配置文件位於:/etc/yum.repos.d/epel-testing.repo)。

1.首先檢查系統是否安裝epel-release
Java代碼 複製代碼  收藏代碼
  1. [root@localhost  ~]  
  2. # rpm -q epel-release  
  3. package epel-release is not installed  
[root@localhost ~]
# rpm -q epel-release
package epel-release is not installed


2.安裝EPEL
Java代碼 複製代碼  收藏代碼
  1. [root@localhost  ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  2. Retrieving http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  3. Preparing...                ########################################### [100%]  
  4.    1:epel-release           ########################################### [100%]  
[root@localhost ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]


注意:
一、 要安裝最新版本的EPEL,請前往 http://mirrors.ustc.edu.cn/fedora/epel/ 中查找最新版本的URL地址,這裏採用的是6.8版本
32位:http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
64位:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

二、若出現下面相似錯誤,則表示對應的URL已經不存在,須要從新找EPEL的版本,請前往 http://mirrors.ustc.edu.cn/fedora/epel/ 獲取須要的版本
Java代碼 複製代碼  收藏代碼
  1. [root@localhost  ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  2. Retrieving http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  3. curl: (22) The requested URL returned error: 404 Not Found  
  4. error: skipping http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm - transfer failed  
[root@localhost ~]# rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
curl: (22) The requested URL returned error: 404 Not Found
error: skipping http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm - transfer failed


#2.1 安裝成功
Java代碼 複製代碼  收藏代碼
  1. [root@localhost  ~]# rpm -q epel-release  
  2. epel-release-6-8.noarch  
[root@localhost ~]# rpm -q epel-release
epel-release-6-8.noarch


#2.2 查看其所依附的軟件文件
Java代碼 複製代碼  收藏代碼
  1. [root@localhost  ~]# rpm -qR epel-release    
  2. /bin/sh    
  3. /bin/sh    
  4. config(epel-release) = 6-8  
  5. redhat-release >= 6  
  6. rpmlib(CompressedFileNames) <= 3.0.4-1  
  7. rpmlib(FileDigests) <= 4.6.0-1  
  8. rpmlib(PayloadFilesHavePrefix) <= 4.0-1  
  9. rpmlib(PayloadIsXz) <= 5.2-1  
[root@localhost ~]# rpm -qR epel-release  
/bin/sh  
/bin/sh  
config(epel-release) = 6-8
redhat-release >= 6
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


#2.3 卸載
Java代碼 複製代碼  收藏代碼
  1. [root@localhost ~]# rpm -e epel-release  
  2. warning: /etc/yum.repos.d/epel.repo saved as /etc/yum.repos.d/epel.repo.rpmsave  
[root@localhost ~]# rpm -e epel-release
warning: /etc/yum.repos.d/epel.repo saved as /etc/yum.repos.d/epel.repo.rpmsave


#2.4 設置源級別
Java代碼 複製代碼  收藏代碼
  1. [root@localhost ~]# vi /etc/yum.repos.d/epel.repo  
  2. 設置 /etc/yum.repos.d/epel.repo 中源的級別爲 priority=11  
[root@localhost ~]# vi /etc/yum.repos.d/epel.repo
設置 /etc/yum.repos.d/epel.repo 中源的級別爲 priority=11


#2.5 搜索軟件包
若要查看 EPEL Repo 中是否存在某個軟件包:yum search package-name,若搜索git
Java代碼 複製代碼  收藏代碼
  1. [root@localhost ~]# yum search git  
  2. Loaded plugins: fastestmirror, refresh-packagekit, security  
  3. Loading mirror speeds from cached hostfile  
  4.  * base: mirrors.aliyun.com  
  5.  * epel: mirrors.hust.edu.cn  
  6.  * extras: mirrors.aliyun.com  
  7.  * updates: mirror.bit.edu.cn  
  8. ============================== N/S Matched: git ===============================  
  9. nodejs-github-url-from-git.noarch : Parse a GitHub git URL and return the GitHub repository URL  
  10. php-phpunit-git.noarch : Simple wrapper for Git  
  11. trac-git-plugin.noarch : GIT version control plugin for Trac  
  12. GitPython.noarch : Python Git Library  
  13. cgit.x86_64 : A fast web interface for git  
  14. git-annex.x86_64 : Manage files with git, without checking their contents into git  
  15. git-ftp.noarch : Git powered FTP client written as shell script  
  16. git-gui.noarch : Git GUI tool  
  17. git-review.noarch : A git helper for integration with Gerrit  
  18. git2cl.noarch : Converts git logs to GNU style ChangeLog format  
  19. gitolite.noarch : Highly flexible server for git directory version tracker  
  20. gitosis.noarch : Git repository hosting application  
  21. gitstats.noarch : Generates statistics based on GIT repository activity  
  22. // ……(略)  
  23. tkgate-fr.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator  
  24. tkgate-it.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator  
  25. tkgate-ja.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator  
  26. tuxpaint.x86_64 : Drawing program designed for young children  
  27. xmlsec1-devel.i686 : Libraries, includes, etc. to develop applications with XML Digital  
  28.                    : Signatures and XML Encryption support.  
  29. xmlsec1-devel.x86_64 : Libraries, includes, etc. to develop applications with XML Digital  
  30.                      : Signatures and XML Encryption support.  
  31.   
  32.   Name and summary matches only, use "search all" for everything.  
[root@localhost ~]# yum search git
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.hust.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirror.bit.edu.cn
============================== N/S Matched: git ===============================
nodejs-github-url-from-git.noarch : Parse a GitHub git URL and return the GitHub repository URL
php-phpunit-git.noarch : Simple wrapper for Git
trac-git-plugin.noarch : GIT version control plugin for Trac
GitPython.noarch : Python Git Library
cgit.x86_64 : A fast web interface for git
git-annex.x86_64 : Manage files with git, without checking their contents into git
git-ftp.noarch : Git powered FTP client written as shell script
git-gui.noarch : Git GUI tool
git-review.noarch : A git helper for integration with Gerrit
git2cl.noarch : Converts git logs to GNU style ChangeLog format
gitolite.noarch : Highly flexible server for git directory version tracker
gitosis.noarch : Git repository hosting application
gitstats.noarch : Generates statistics based on GIT repository activity
// ……(略)
tkgate-fr.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator
tkgate-it.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator
tkgate-ja.x86_64 : Locales and examples for tkgate, Digital Circuit Simulator
tuxpaint.x86_64 : Drawing program designed for young children
xmlsec1-devel.i686 : Libraries, includes, etc. to develop applications with XML Digital
                   : Signatures and XML Encryption support.
xmlsec1-devel.x86_64 : Libraries, includes, etc. to develop applications with XML Digital
                     : Signatures and XML Encryption support.

  Name and summary matches only, use "search all" for everything.



3. 安裝第三方軟件
使用yum install package-name命令安裝第三方軟件,如使用yum install git安裝git
Java代碼 複製代碼  收藏代碼
  1. [root@localhost ~]# yum install git  
  2. Loaded plugins: fastestmirror, refresh-packagekit, security  
  3. Loading mirror speeds from cached hostfile  
  4. epel/metalink                                                 | 5.5 kB     00:00       
  5.  * base: mirrors.aliyun.com  
  6.  * epel: ftp.sjtu.edu.cn  
  7.  * extras: mirrors.aliyun.com  
  8.  * updates: mirror.bit.edu.cn  
  9. epel                                                          | 4.4 kB     00:00       
  10. epel/primary_db                                               | 6.0 MB     01:19       
  11. Setting up Install Process  
  12. Resolving Dependencies  
  13. --> Running transaction check  
  14. ---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed  
  15. --> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64  
  16. --> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64  
  17. --> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64  
  18. --> Running transaction check  
  19. ---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed  
  20. ---> Package perl-Git.noarch 0:1.7.1-3.el6_4.1 will be installed  
  21. --> Finished Dependency Resolution  
  22.   
  23. Dependencies Resolved  
  24.   
  25. ==================================================================================  
  26.  Package                Arch       Version                 Repository        Size  
  27. ==================================================================================  
  28. Installing:  
  29.  git                    x86_64     1.7.1-3.el6_4.1         base             4.6 M  
  30. Installing for dependencies:  
  31.  perl-Error             noarch     1:0.17015-4.el6         base              29 k  
  32.  perl-Git               noarch     1.7.1-3.el6_4.1         base              28 k  
  33.   
  34. Transaction Summary  
  35. ==================================================================================  
  36. Install       3 Package(s)  
  37.   
  38. Total download size: 4.7 M  
  39. Installed size: 15 M  
  40. Is this ok [y/N]: y  
  41. Downloading Packages:  
  42. (1/3): git-1.7.1-3.el6_4.1.x86_64.rpm                         | 4.6 MB     00:33       
  43. (2/3): perl-Error-0.17015-4.el6.noarch.rpm                    |  29 kB     00:00       
  44. (3/3): perl-Git-1.7.1-3.el6_4.1.noarch.rpm                    |  28 kB     00:00       
  45. ----------------------------------------------------------------------------------  
  46. Total                                                          140 kB/s | 4.7 MB     00:34       
  47. warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY  
  48. Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  
  49. Importing GPG key 0xC105B9DE:  
  50.  Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>  
  51.  Package: centos-release-6-4.el6.centos.10.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4)  
  52.  From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  
  53. Is this ok [y/N]: y    (注:這裏爲輸入的內容,導入GPG key)  
  54. Running rpm_check_debug  
  55. Running Transaction Test  
  56. Transaction Test Succeeded  
  57. Running Transaction  
  58. Warning: RPMDB altered outside of yum.  
  59.   Installing : 1:perl-Error-0.17015-4.el6.noarch                             1/3   
  60.   Installing : perl-Git-1.7.1-3.el6_4.1.noarch                               2/3   
  61.   Installing : git-1.7.1-3.el6_4.1.x86_64                                    3/3   
  62.   Verifying  : git-1.7.1-3.el6_4.1.x86_64                                    1/3   
  63.   Verifying  : perl-Git-1.7.1-3.el6_4.1.noarch                               2/3   
  64.   Verifying  : 1:perl-Error-0.17015-4.el6.noarch                             3/3   
  65.   
  66. Installed:  
  67.   git.x86_64 0:1.7.1-3.el6_4.1                                                                   
  68.   
  69. Dependency Installed:  
  70.   perl-Error.noarch 1:0.17015-4.el6              perl-Git.noarch 0:1.7.1-3.el6_4.1               
  71.   
  72. Complete!  
[root@localhost ~]# yum install git
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink                                                 | 5.5 kB     00:00     
 * base: mirrors.aliyun.com
 * epel: ftp.sjtu.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirror.bit.edu.cn
epel                                                          | 4.4 kB     00:00     
epel/primary_db                                               | 6.0 MB     01:19     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed
---> Package perl-Git.noarch 0:1.7.1-3.el6_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================
 Package                Arch       Version                 Repository        Size
==================================================================================
Installing:
 git                    x86_64     1.7.1-3.el6_4.1         base             4.6 M
Installing for dependencies:
 perl-Error             noarch     1:0.17015-4.el6         base              29 k
 perl-Git               noarch     1.7.1-3.el6_4.1         base              28 k

Transaction Summary
==================================================================================
Install       3 Package(s)

Total download size: 4.7 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): git-1.7.1-3.el6_4.1.x86_64.rpm                         | 4.6 MB     00:33     
(2/3): perl-Error-0.17015-4.el6.noarch.rpm                    |  29 kB     00:00     
(3/3): perl-Git-1.7.1-3.el6_4.1.noarch.rpm                    |  28 kB     00:00     
----------------------------------------------------------------------------------
Total                                                          140 kB/s | 4.7 MB     00:34     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-4.el6.centos.10.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y    (注:這裏爲輸入的內容,導入GPG key)
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : 1:perl-Error-0.17015-4.el6.noarch                             1/3 
  Installing : perl-Git-1.7.1-3.el6_4.1.noarch                               2/3 
  Installing : git-1.7.1-3.el6_4.1.x86_64                                    3/3 
  Verifying  : git-1.7.1-3.el6_4.1.x86_64                                    1/3 
  Verifying  : perl-Git-1.7.1-3.el6_4.1.noarch                               2/3 
  Verifying  : 1:perl-Error-0.17015-4.el6.noarch                             3/3 

Installed:
  git.x86_64 0:1.7.1-3.el6_4.1                                                                 

Dependency Installed:
  perl-Error.noarch 1:0.17015-4.el6              perl-Git.noarch 0:1.7.1-3.el6_4.1             

Complete!


4. 參考資料 [1]EPEL https://fedoraproject.org/wiki/EPEL [2]CentOS 6.2安裝第三方軟件庫epel http://blog.csdn.net/jackalfly/article/details/7572886 
相關文章
相關標籤/搜索