第一次在51CTO上发表文章,技术实力有限,还希望各位同仁不要拍砖在RHEL6.4中安装EPEL源_软件包

https://fedoraproject.org/wiki/EPEL/zh-cn

上面为EPEL源的中文网站,有兴趣的同仁可以上去看看


EPEL 是什么?

   企业版 Linux 附加软件包(以下简称 EPEL)是一个由特别兴趣小组创建、维护并管理的,针对红帽企业版 Linux(RHEL)及其衍生发行版(比如 CentOS、Scientific Linux、Oracle Enterprise Linux)的一个高质量附加软件包项目。

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

RHEL/CentOS系统有许多第三方源,比较流行的比如RpmForge,RpmFusion,EPEL,Remi等等。

然而需要引起注意的是,如果系统添加了多个第三方源,可能会因此产生冲突——一个软件包可以从多个源获取,一些源会替换系统的基础软件包,从而可能会产生意想不到的错误。已知的就有Rpmforge与EPEL会产生冲突。

对于这些问题我建议,调整源的优先权或者有选择性的安装源,但是这需要复杂的操作,如果你不确定如何操作,我推荐你只安装一个第三方源。

   下面写写我自己安装EPEL源的过程和遇到的问题:


1.首先需要确认自己系统的版本:

[root@localhost ~]# cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 6.4 (Santiago)


2.然后根据自己的版本下载EPEL的安装包:

[root@localhost ~]# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm


这时可以看到安装包已经下载到本地了在RHEL6.4中安装EPEL源_第三方_02

[root@localhost ~]# ls

anaconda-ks.cfg  Downloads                               install.log.syslog   Public

Desktop               epel-release-6-8.noarch.rpm    Music                   Templates

Documents          install.log                                 Pictures                Videos


3.通过以下命令安装EPEL的安装包:

[root@localhost ~]# rpm -ivh epel-release-6-8.noarch.rpm


4.安装好EPEL源以后,通过yum命令来检查是否添加到源列表中:

[root@localhost ~]# yum clean all

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Cleaning repos: HighAvailability LoadBalancer ResilientStorage

              : ScalableFileSystem Server epel

Cleaning up Everything


[root@localhost ~]# yum repolist

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

HighAvailability                                         | 3.9 kB     00:00 ... 

HighAvailability/primary_db                              |  44 kB     00:00 ... 

LoadBalancer                                             | 3.9 kB     00:00 ... 

LoadBalancer/primary_db                                  | 7.0 kB     00:00 ... 

ResilientStorage                                         | 3.9 kB     00:00 ... 

ResilientStorage/primary_db                              |  48 kB     00:00 ... 

ScalableFileSystem                                       | 3.9 kB     00:00 ... 

ScalableFileSystem/primary_db                            | 7.2 kB     00:00 ... 

Server                                                   | 3.9 kB     00:00 ... 

Server/primary_db                                        | 3.1 MB     00:00 ... 

epel/metalink                                            | 5.6 kB     00:00     

epel                                                     | 4.4 kB     00:00     

epel/primary_db                                          | 6.2 MB     00:12     

repo id                       repo name                                                         status

HighAvailability          HighAvailability                                                   56

LoadBalancer             LoadBalancer                                                       4

ResilientStorage         ResilientStorage                                                   62

ScalableFileSystem     ScalableFileSystem                                               7

Server                        Server                                                                  3,648

epel                           Extra Packages for Enterprise Linux 6 - x86_64      10,946

repolist: 14,723

上面可以看到EPEL源已经成功添加到源列表中去了,并且显示已经提供了上万个软件包!在RHEL6.4中安装EPEL源_RHEL6.4_03



下面来说说其中遇到的一些问题:

其实安装完成EPEL源以后,检查是否添加进源列表的时候,会报错的!在RHEL6.4中安装EPEL源_RHEL6.4_04


[root@localhost ~]# yum repolist

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

HighAvailability                                                                                                                                                        | 3.9 kB     00:00 ... 

HighAvailability/primary_db                                                                                                                                             |  44 kB     00:00 ... 

LoadBalancer                                                                                                                                                            | 3.9 kB     00:00 ... 

LoadBalancer/primary_db                                                                                                                                                 | 7.0 kB     00:00 ... 

ResilientStorage                                                                                                                                                        | 3.9 kB     00:00 ... 

ResilientStorage/primary_db                                                                                                                                             |  48 kB     00:00 ... 

ScalableFileSystem                                                                                                                                                      | 3.9 kB     00:00 ... 

ScalableFileSystem/primary_db                                                                                                                                           | 7.2 kB     00:00 ... 

Server                                                                                                                                                                  | 3.9 kB     00:00 ... 

Server/primary_db                                                                                                                                                       | 3.1 MB     00:00 ... 

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again


大家可以看到上面的报错,非常让人郁闷,这个EPEL源不是都封装好了吗?出现这样的问题,我们还是要回去找找原因在RHEL6.4中安装EPEL源_软件包_05

首先还是要去/etc/yum.repos.d/下面去查看

[root@localhost ~]# ls /etc/yum.repos.d/

epel.repo              epel-testing.repo      packagekit-media.repo  rhel6.repo             rhel-source.repo   

可以看到多了三个文件,其中第二个文件epel-testing.repo这个源中包含最新的测试软件包,其版本很新,但是安装有风险,并且可以看到EPEL源安装完成以后默认就没有打开这个源,全部设置为enabled=0,所以不用去管他!


打开第一个配置文件查看:

[root@localhost ~]# vim /etc/yum.repos.d/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


[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

从上面可以看到只有第一个源是打开的,并且源路径设置为

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

可以看到它是通过https来获取源的,但是我们自己的系统不一定获取了证书,所以使用https就不一定可以获取到源,我们只需要把其中的https修改为http:

mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

然后保存配置文件,在次通过yum命令来检查源,这次可以看到已经不会在报错了,EPEL源添加成功!