In this tutorial, we'll show you how to enable EPEL repository on CentOS.
prerequisites
Before starting the tutorial, make sure you log in as a user with sudo privileges.
Enable EPEL repository on CentOS 7
Enable EPEL repository on CentOS 7 is a very simple task, because EPEL rpm package included in CentOS extras repository.
To install EPEL release package, type the following command:
sudo yum install epel-release
Run the command yum repolist to verify EPEL repository is enabled, this command lists all available repositories.
sudo yum repolist
This command displays the repo ID, name and number of packages enabled repository. Information should be included in the output of the line EPEL repository.
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
...
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,019
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,912
extras/7/x86_64 CentOS-7 - Extras 371
updates/7/x86_64 CentOS-7 - Updates 1,098
repolist: 24,400
So far, you've enabled EPEL repository on your CentOS system.
Enable EPEL repository on RHEL
This method is applicable to any RHEL-based distributions, including Red Hat, CentOS 6 and 7, Oracle Linux, Amazon Linux and Scientific Linux.
To enable EPEL repository, run the following command, which will download and install EPEL distributions:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm
rpm -E '% {rhel}' will print distributions (6 or 7).
to sum up
For more information about EPEL repository, see EPEL documentation .