How to Enable the EPEL repository on CentOS

Introduction

The EPEL (Extra Packages for Enterprise Linux) repository contains additional software packages not available in the default Red Hat and CentOS repositories. EPEL was formed because Fedora developers wished to use the packages they maintain on Red Hat Enterprise Linux (RHEL) and its derivatives such as CentOS, Oracle Linux, and Scientific Linux.

You may access well-known software packages like Nginx, R, and Python Pip by enabling this repository.

Prerequisites

Make sure you are logged in as a user with sudo privileges before starting the lesson.

Enabling the EPEL Repository on CentOS 7

Since the EPEL rpm package is already present in the CentOS extras repository, enabling the EPEL repository on CentOS 7 is a simple task.

Please enter the following command to install the EPEL release package:

sudo yum install epel-release

Run the yum repolist command, which lists all accessible repositories, to make sure the EPEL repository is enabled.

sudo yum repolist

The repo ID, name, and the number of packages for the enabled repositories are displayed by the command. The EPEL repository should be listed in the output.

Output

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

All done. The EPEL repository has been activated on your CentOS system.

Enabling the EPEL Repository on RHEL

The RHEL-based distributions including Red Hat, CentOS 6 and 7, Oracle Linux, Amazon Linux, and Scientific Linux are all compatible with this method.

Run the following command to download and install the EPEL release package and enable the EPEL repository:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm
rpm -E '%{rhel}' will print the distribution version (6 or 7).

Conclusion

Visit the EPEL documentation for more information about the EPEL repository.

If you have any queries, feel free to comment down below and we'll be glad to help you.