How to enable EPEL repository on Centos
What’s an ‘EPEL repository’?
The EPEL repository is managed by the EPEL group, which is a Special Interest Group within the Fedora Project. The ‘EPEL’ part is an abbreviation that stands for Extra Packages for Enterprise Linux. The EPEL group creates, maintains and manages a high-quality set of additional packages. These packages may be software not included in the core repository, or sometimes updates which haven’t been provided yet.
The EPEL repository can be used with the following Linux Distributions:
- Red Hat Enterprise Linux (RHEL)
- CentOS
- Scientific Linux
- Oracle Linux
Enabling the EPEL repo
Method I. Installing EPEL on CentOS via yum
By far CentOS is the easiest distro to install EPEL on. The CentOS distribution includes a repo called ‘CentOS Extras’ by default. Within this repo users can find a EPEL package, so in this case enabling EPEL is as easy as installing any other package.
just run the following command:
# yum install epel-release
If, for whatever reason, your version of CentOS is missing the CentOS Extras repo necessary for this to work you can follow the directions below.
Method II. Officially install EPEL via fedoraproject
-
RHEL/CentOS 6:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
-
RHEL/CentOS 7:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- on RHEL 7 it is recommended to also enable the optional, extras, and HA repositories since EPEL packages may depend on packages from these repositories:
# subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" --enable "rhel-ha-for-rhel-*-server-rpms"
- on RHEL 7 it is recommended to also enable the optional, extras, and HA repositories since EPEL packages may depend on packages from these repositories:
-
RHEL/CentOS 8:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
- on RHEL 8 it is required to also enable the codeready-builder-for-rhel-8-*-rpms repository since EPEL packages may depend on packages from it:
# ARCH=$(/bin/arch) # subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"
- on CentOS 8 it is recommended to also enable the PowerTools repository since EPEL packages may depend on packages from it:
# dnf config-manager --set-enabled PowerTools
- on RHEL 8 it is required to also enable the codeready-builder-for-rhel-8-*-rpms repository since EPEL packages may depend on packages from it:
Centos 6 error message using epel "Cannot retrieve metalink for repository: epel. Please verify its path and try again"
As a solution, uncomment the third line
of the /etc/yum.repos.d/epel.repo
file and comment out the fourth line
.
-
open file
/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
-
Modify it to:
[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
-
Clean and reinstall your package
# yum clean all # yum install -y "your package"
If that doesn’t work, modify DNS
-
Open the
/etc/resolv.conf
file and add the following:nameserver 8.8.8.8 search localdomain
-
Then restart the network service
# service network restart