How to install and enable EPEL repo on CentOS 7

EPEL  is an open source and free community based repository project which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux.

By adding EPEL repo in your server’s repository source, you’ll be able to install lots of open source packages via Yum.

To install EPEL repo login to your server via SSH and run the following command:

yum -y install epel-release

Now refresh repo by typing the following command:

yum repolist

If the above one does not work, try this. Download EPEL .rpm file to tmp folder:

cd /tmp
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
ls *.rpm

Then run below command to install the EPEL .rpm file:

yum install epel-release-7.noarch.rpm

Now to verify:

yum repolist

The main command to use with yum is:

yum --enablerepo=epel [command] [package name]

For example:

yum --enablerepo=epel install htop

That’s all.