epel是centos的衍生发行版,用来弥补centos更新比较滞后的一些扩展源,是由fedora社区打造,安装后就可以yum安装以前需要编译安装的软件,比如nginx,iftop,openvpn等等。


需要下载系统对应的epel包 http://dl.fedoraproject.org/pub/epel/ 

PS:如果有些需要安装的软件用yum不能安装,对于新装的系统,可以先考虑有没有安装epel扩展源。


EPEL提供了上万个软件包

安装位置/etc/yum.repos.d/epel.repo文件


wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

rpm -ivh epel-release-7-5.noarch.rpm


-----------------------------------------------------------------------------------------------------------------------------------------------

EPEL安装源:(这种方法更简单,不需要大规模yum -y update)

CentOS/RHEL 5 :

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm


CentOS/RHEL 6 :

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm



CentOS/RHEL 7 :

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm


Ok 安装完毕。

-----------------------------------------------------------------------------------------------------------------------------------------------

命令安装:

yum search epel-release

yum -y install epel-release

即可。


-----------------------------------------------------------------------------------------------------------------------------------------------

手动添加epel源配置

vim /etc/yum.repos.d/epel.repo

[epel]

name=Extra Packages for Enterprise Linux 7 - $basearch

#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch

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

failovermethod=priority

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7


[epel-debuginfo]

name=Extra Packages for Enterprise Linux 7 - $basearch - Debug

#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug

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

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=1


[epel-source]

name=Extra Packages for Enterprise Linux 7 - $basearch - Source

#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS

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

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=1


然后执行:

yum clean all
yum makecache

即可


其实yum -y install epel-release和rpm -ivh xxx都是在/etc/yum.repos.d/路径下自动生成epel.repo和epel-testing.repo文件。但是默认情况下只有epel-testing.repo文件是生效的,如果想使用测试版,vim epel-testing.repo,把enabled=0改成enabled=1即可。


如果不想使用epel的yum源,把enabled=1改成enabled=0,或者直接卸载rpm -e epel-release.