在CentOS 6上安装EPEL源

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在CentOS 6上安装EPEL源相关的知识,希望对你有一定的参考价值。

EPEL 是什么?


EPEL (Extra Packages for Enterprise Linux,企业版Linux的额外软件包) 是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供他们默认不提供的软件包。这个源兼容RHEL及像CentOS和Scientific Linux这样的衍生版本。



我们可以很容易地通过yum命令从EPEL源上获取上万个在CentOS自带源上没有的软件。EPEL提供的软件包大多基于其对应的Fedora软件包,不会与企业版Linux发行版本的软件发生冲突或替换其文件。


更多关于EPEL 项目的细节可以到以下网站获取:https://fedoraproject.org/wiki/EPEL


在文本中,我将展示在CentOS下如何安装EPEL源(系统为centos 6.8  root用户)



在CentOS 上安装EPEL

要想安装EPEL,我们先要下载EPEL的rpm安装包。


CentOS/RHEL下的6.x和5.x版本下载页面如下


http://download.fedoraproject.org/pub/epel/6/i386/repoview/epel-release.htmlhttp://download.fedoraproject.org/pub/epel/5/i386/repoview/epel-release.html


以上网址可能会被重定向到特定的镜像站而加快下载速度。这个页面包含可以直接获取到rpm包的下载链接。直接的下载链接如下:


http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmhttp://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm


根据你的CentOS 版本来选择正确的下载地址。


请注意EPEL 的安装包是独立编译的,所以它可以安装在32位和64位系统中。


1. 确认你的CentOS 的版本

首先通过以下命令确认你的CentOS 版本


$cat /etc/redhat-release 
CentOS release 6.8 (Final)

2. 下载EPEL 的rpm 安装包

现在从上面的地址下载CentOS 版本所对应的EPEL 的版本

$ wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

3. 安装EPEL

通过以下命令安装EPEL 软件包

$ rpm -ivh epel-release-6-8.noarch.rpm

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已经在repo 后列出,并且显示提供了上万个软件包,所以EPEL 已经安装到你的CentOS了。


EPEL源的配置安装到了 /etc/yum.repos.d/epel.repo 文件。


现在来试一下从EPEL 获取软件包

$ yum install java
yum -y install java
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless = 1:1.8.0.111-0.b15.el6_8 for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libjli.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libjli.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: libawt.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64
--> Running transaction check
---> Package giflib.x86_64 0:4.1.6-3.1.el6 will be installed
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed
--> Processing Dependency: tzdata-java >= 2014f-1 for package: 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64
--> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64
---> Package xorg-x11-fonts-Type1.noarch 0:7.2-11.el6 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Running transaction check
---> Package jpackage-utils.noarch 0:1.7.5-3.16.el6 will be installed
---> Package ttmkfdir.x86_64 0:3.0.9-32.1.el6 will be installed
---> Package tzdata-java.noarch 0:2016j-1.el6 will be installed
---> Package xorg-x11-font-utils.x86_64 1:7.2-11.el6 will be installed
--> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.2-11.el6.x86_64
--> Processing Dependency: libXfont.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.2-11.el6.x86_64
--> Running transaction check
---> Package libXfont.x86_64 0:1.5.1-2.el6 will be installed
---> Package libfontenc.x86_64 0:1.1.2-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================
 Package                                 Arch               Version                              Repository           Size
===========================================================================================================================
Installing:
 java-1.8.0-openjdk                      x86_64             1:1.8.0.111-0.b15.el6_8              updates             198 k
Installing for dependencies:
 giflib                                  x86_64             4.1.6-3.1.el6                        base                 37 k
 java-1.8.0-openjdk-headless             x86_64             1:1.8.0.111-0.b15.el6_8              updates              32 M
 jpackage-utils                          noarch             1.7.5-3.16.el6                       base                 60 k
 libXfont                                x86_64             1.5.1-2.el6                          base                145 k
 libfontenc                              x86_64             1.1.2-3.el6                          base                 29 k
 ttmkfdir                                x86_64             3.0.9-32.1.el6                       base                 43 k
 tzdata-java                             noarch             2016j-1.el6                          updates             182 k
 xorg-x11-font-utils                     x86_64             1:7.2-11.el6                         base                 75 k
 xorg-x11-fonts-Type1                    noarch             7.2-11.el6                           base                520 k
Transaction Summary
===========================================================================================================================
Install      10 Package(s)
Total download size: 33 M
Installed size: 105 M
Downloading Packages:
(1/10): giflib-4.1.6-3.1.el6.x86_64.rpm                                                             |  37 kB     00:00     
(2/10): java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64.rpm                                         | 198 kB     00:00     
(3/10): java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64.rpm                                |  32 MB     00:51     
(4/10): jpackage-utils-1.7.5-3.16.el6.noarch.rpm                                                    |  60 kB     00:00     
(5/10): libXfont-1.5.1-2.el6.x86_64.rpm                                                             | 145 kB     00:00     
(6/10): libfontenc-1.1.2-3.el6.x86_64.rpm                                                           |  29 kB     00:00     
(7/10): ttmkfdir-3.0.9-32.1.el6.x86_64.rpm                                                          |  43 kB     00:00     
(8/10): tzdata-java-2016j-1.el6.noarch.rpm                                                          | 182 kB     00:00     
(9/10): xorg-x11-font-utils-7.2-11.el6.x86_64.rpm                                                   |  75 kB     00:00     
(10/10): xorg-x11-fonts-Type1-7.2-11.el6.noarch.rpm                                                 | 520 kB     00:00     
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                      634 kB/s |  33 MB     00:53     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libfontenc-1.1.2-3.el6.x86_64                                                                          1/10 
  Installing : libXfont-1.5.1-2.el6.x86_64                                                                            2/10 
  Installing : 1:xorg-x11-font-utils-7.2-11.el6.x86_64                                                                3/10 
  Installing : tzdata-java-2016j-1.el6.noarch                                                                         4/10 
  Installing : jpackage-utils-1.7.5-3.16.el6.noarch                                                                   5/10 
  Installing : 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64                                             6/10 
  Installing : giflib-4.1.6-3.1.el6.x86_64                                                                            7/10 
  Installing : ttmkfdir-3.0.9-32.1.el6.x86_64                                                                         8/10 
  Installing : xorg-x11-fonts-Type1-7.2-11.el6.noarch                                                                 9/10 
  Installing : 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64                                                     10/10 
  Verifying  : ttmkfdir-3.0.9-32.1.el6.x86_64                                                                         1/10 
  Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64                                             2/10 
  Verifying  : giflib-4.1.6-3.1.el6.x86_64                                                                            3/10 
  Verifying  : jpackage-utils-1.7.5-3.16.el6.noarch                                                                   4/10 
  Verifying  : 1:xorg-x11-font-utils-7.2-11.el6.x86_64                                                                5/10 
  Verifying  : 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64                                                      6/10 
  Verifying  : libfontenc-1.1.2-3.el6.x86_64                                                                          7/10 
  Verifying  : xorg-x11-fonts-Type1-7.2-11.el6.noarch                                                                 8/10 
  Verifying  : libXfont-1.5.1-2.el6.x86_64                                                                            9/10 
  Verifying  : tzdata-java-2016j-1.el6.noarch                                                                        10/10 
Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.111-0.b15.el6_8                                                                        
Dependency Installed:
  giflib.x86_64 0:4.1.6-3.1.el6                       java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-0.b15.el6_8           
  jpackage-utils.noarch 0:1.7.5-3.16.el6              libXfont.x86_64 0:1.5.1-2.el6                                        
  libfontenc.x86_64 0:1.1.2-3.el6                     ttmkfdir.x86_64 0:3.0.9-32.1.el6                                     
  tzdata-java.noarch 0:2016j-1.el6                    xorg-x11-font-utils.x86_64 1:7.2-11.el6                              
  xorg-x11-fonts-Type1.noarch 0:7.2-11.el6           
Complete!


本文出自 “宫盖” 博客,请务必保留此出处http://jazzdaum.blog.51cto.com/6223324/1878929

以上是关于在CentOS 6上安装EPEL源的主要内容,如果未能解决你的问题,请参考以下文章

如何在 CentOS 7 上安装 Docker

centos上安装php5.6

在CentOS安装PHP5.6

RedHat 6.4使用CentOS源和epel源

CentOS 6.9通过RPM安装EPEL源(http://dl.fedoraproject.org)

CentOS6.5 安装docker