How to install and enable EPEL repository on a CentOS/RHEL 7

See all Sun CentOS Linux related FAQs
How do I install the extra repositories such as Fedora EPEL repo on a Red Hat Enterprise Linux server version 7.x or CentOS Linux server version 7.x?

You can easily install various packages by configuring a CentOS 7.x or RHEL 7.x system to use Fedora EPEL repos and third party packages. Please note that these packages are not officially supported by either CentOS or Red Hat, but provides many popular packages and apps. This quick tutorial explains how to configure a CentOS or Red Hat Enterprise Linux (RHEL) version 7.x to use the Fedora Extra Packages for Enterprise Linux (EPEL) repository.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux terminal
Category Package Manager
OS compatibility CentOS Linux RHEL
Est. reading time 3 minutes

What is an EPEL repository (repo)?

The EPEL repository was created by the EPEL group working at the Fedora Project. The EPEL is an acronym for Extra Packages for Enterprise Linux. The EPEL repository used by the following Linux Distributions:

  • Red Hat Enterprise Linux (RHEL)
  • CentOS including latest CentOS Stream
  • Oracle Linux
  • Fedora Linux
  • Alma and Rocky Linux

Installing EPEL repository on a CentOS Linux and RHEL 7.x

The procedure to enable EPEL repository for a CentOS/RHEL 7.x server is as follows:

  1. Open a shell prompt.
  2. Or login to a host called server1 using ssh client. Run su - or sudo -i to gain root access.
  3. First, update CentOS/RHEL repos by running yum update.
  4. Install epel repository using: yum -y install epel-release.
  5. Refresh epel repo by typing: yum repolist.
  6. Install packages from epel repo : yum install pkg1.

How to install EPEL repo on a CentOS and RHEL 7.x

The following instructions assumes that you are running command as root user on a CentOS/RHEL 7.x system and want to use use Fedora Epel repository.

Method #1: Install Extra Packages for Enterprise Linux repository configuration (recommended)

Just type the following yum command on a CentOS 7 or RHEL 7:
$ sudo yum install epel-release

Fig.01: How To Install EPEL Repo on a CentOS and RHEL 7.x

Fig.01: Installing epel-release package on a Centos 7

Note: If method #1 failed, try the following method #2 to install EPEL Repo.

Method #2: Install the extra EPEL repositories from dl.fedoraproject.org

The command is as follows to download epel release for CentOS and RHEL 7.x using wget command or use curl command to download file. For example::
$ cd /tmp/
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ ls *.rpm

To install epel-release-latest-7.noarch.rpm, type the following yum command:
$ sudo yum install epel-release-latest-7.noarch.rpm
Sample outputs from CentOS version

Loaded plugins: fastestmirror, langpacks
Examining epel-release-latest-7.noarch.rpm: epel-release-7-14.noarch
Marking epel-release-latest-7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-14 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===============================================================================
 Package          Arch       Version   Repository                         Size
===============================================================================
Installing:
 epel-release     noarch     7-14      /epel-release-latest-7.noarch      25 k
 
Transaction Summary
===============================================================================
Install  1 Package
 
Total size: 25 k
Installed size: 25 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-14.noarch                                    1/1 
  Verifying  : epel-release-7-14.noarch                                    1/1 
 
Installed:
  epel-release.noarch 0:7-14                                                   
 
Complete!

List your new repos

Once installed you should see epel repo using the following yum repolist command
$ sudo yum repolist
Sample outputs (look for “Extra Packages for Enterprise Linux 7” line):

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: mirror.sabay.com.kh
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
repo id              repo name                                           status
base/7/x86_64        CentOS-7 - Base                                     10,072
epel/x86_64          Extra Packages for Enterprise Linux 7 - x86_64      13,746
extras/7/x86_64      CentOS-7 - Extras                                      515
updates/7/x86_64     CentOS-7 - Updates                                   4,425
repolist: 28,758

Search and install package

To list all available packages under a repo called epel, enter:
$ sudo yum --disablerepo="*" --enablerepo="epel" list available
OR
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | grep 'package'
OR
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | less
Sample outputs:

Fig. 02: List all available packages under a EPEL Repo on a CentOS/RHEL/Fedora Linux

Fig. 02: List all available packages under a EPEL Repo on a CentOS/RHEL/Fedora Linux

Example: Search and install htop package from epel repo on a CentOS/RHEL 7.x

The commands are as follows (see yum our command guide for more info):

## search it ##
sudo yum search htop
 
## get more info, if found ##
sudo yum info htop
 
## install it ##
sudo yum install htop

And, there you have it, a larger number of packages to install from EPEL repo on a CentOS and Red Hat Enterprise Linux (RHEL) version 7.x.

Conclusion

You learned how to install and enable EPEL repository on a CentOS or RHEL 7.x server. See:

Read the following manual pages using the man command or yum command:
$ man yum
$ man wget
$ man curl

This entry is 2 of 5 in the Enable EPEL Repository on a CentOS/RHEL Tutorial series. Keep reading the rest of the series:
  1. CentOS / RHEL / Scientific Linux 6/5 Enable and Install EPEL Repo
  2. How To Install EPEL Repo on a CentOS and RHEL 7.x
  3. yum command: Update / Install Packages Under Redhat Enterprise / CentOS Linux Version 5.x
  4. Install and enable EPEL repo on an RHEL 8.x
  5. CentOS 8 Install and enable EPEL repo

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

29 comments… add one
  • Hakan Orcan Oct 19, 2015 @ 8:54

    Thanks.You really saved my time.

  • DV Apr 2, 2016 @ 12:56

    Thanks!

  • zer0sig Nov 17, 2016 @ 18:14

    Note that above the wget command references epel-release-latest-7.noarch.rpm while the yum install references epel-release-7.noarch.rpm, so if you cut and paste or type exactly what is shown you will get an error as it tries to reference a package that hasn’t been downloaded.

  • Ethan Jan 13, 2017 @ 1:47

    In second method, correct command should be:
    sudo yum install epel-release-latest-7.noarch.rpm

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Jan 13, 2017 @ 6:49

      thanks for the feedback. I faq has been updated. Appreciate your post.

  • taikedz Feb 9, 2017 @ 17:00

    You may find on CentOS that epel-release cannot be found

    To solve, edit your /etc/yum.repos.d/CentOS-Base.repo file and enable the “extras” section, and then run

    sudo yum install epel-release

  • Govind Dec 8, 2022 @ 13:11

    Getting below error for “yum install epel-release-latest-7.noarch.rpm”

    warning: /scratch/epel-release-latest-7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY

    Public key for epel-release-latest-7.noarch.rpm is not installed

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Dec 9, 2022 @ 4:00

      try
      yum update
      yum -y install epel-release

    • JB4096 Feb 25, 2023 @ 3:06

      Sounds like you have gpgcheck enabled for yum
      Try:
      yum --nogpgcheck install epel-release-latest-7.noarch.rpm

      • Anonymous Apr 26, 2023 @ 10:53

        giving me the error like below:

        [root@ip-10-127-2-198 ~]# yum –nogpgcheck install epel-release-latest-7.noarch.rpm
        Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
        https://packages.icinga.com/subscription/amazon/al2/release/repodata/repomd.xml: [Errno 14] HTTPS Error 401 – Unauthorized
        Trying other mirror.
        235 packages excluded due to repository priority protections
        No package epel-release-latest-7.noarch.rpm available.
        Error: Nothing to do

        • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Apr 26, 2023 @ 16:15

          that sounds like repo that requires payment or other conditions. Try:

          # cd /tmp/
          # wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
          # ls *.rpm
          # yum install ./epel-release-latest-7.noarch.rpm
  • Zafar Ali Mar 17, 2023 @ 6:48

    it’s give me error ”unable to locate package epel-release-latest-7.noarch.rpm

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.