How To Install EPEL Repository (Repo) on an RHEL 8

See all Redhat/CentOS/Fedora Core related FAQ
How do I install the extra repositories such as Fedora EPEL Repository (repo) on an Red Hat Enterprise Linux server (RHEL) version 8?

You can easily install various packages by configuring an RHEL 8 system to use Fedora EPEL repos and third party packages. Please note that these packages are not officially supported by Red Hat, Inc, but provides many popular packages and apps. This quick tutorial explains how to configure a Red Hat Enterprise Linux (RHEL) version 8 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
Prerequisites RHEL
OS compatibility Linux RHEL
Est. reading time 5 minutes
Advertisement

Linux commands to install EPEL Repository (repo) on an RHEL 8

The procedure to enable EPEL repository for an RHEL 8 server is as follows:

  1. Open a shell prompt.
  2. Or login to an RHEL 8.x host called server1 using ssh client:$ ssh ec2-user@rhel-8-cloud-server-ip
  3. Install epel repository using the following command:$ sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
    $ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  4. Refresh repo by typing the following command:$ sudo yum repolist
  5. Search for EPEL packages:$ sudo dnf search package_name
  6. Install a new package from EPEL repo:$ sudo dnf install pkg_name_here

Let us see all commands and options in details to enable the EPEL Repository on RHEL 8 Linux.

You can use both the yum or dnf command. In fact, yum is soft linked to dnf, and it is kept for backward compatibility reasons on Red Hat Enterprise Linux 8.x.

Installing and enabling EPEL repo on an RHEL 8

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

Install Extra Packages for Enterprise Linux repository configuration

Just type the following yum command on an RHEL 8:
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install EPEL Repo on an RHEL 8.x
Now that EPEL repo installed it is time to configure and use it. Hence, run the following command:
$ sudo yum update
Sample outputs:

Extra Packages for Enterprise Linux 8 - x86_64  198 kB/s | 430 kB     00:02    
Red Hat Update Infrastructure 3 Client Configur 1.8 kB/s | 2.1 kB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - AppStre  25 MB/s | 8.6 MB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS   21 MB/s | 6.3 MB     00:00    
Dependencies resolved.
Nothing to do.
Complete!

Enable the codeready-builder-for-rhel-8-*-rpms repository

Since EPEL packages may depend on packages from codeready-builder-for-rhel-8-*-rpms, run:
$ sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-*-rpms"

List your new repos

Let us list our new repo using the yum command. In other words type the following command:
$ sudo yum repolist

Last metadata expiration check: 0:01:36 ago on Thursday 15 August 2019 08:13:39 AM UTC.
repo id                           repo name                                                                 status
*epel                             Extra Packages for Enterprise Linux 8 - x86_64                              310
rhel-8-appstream-rhui-rpms        Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs)        5,739
rhel-8-baseos-rhui-rpms           Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs)           2,097
rhui-client-config-server-8       Red Hat Update Infrastructure 3 Client Configuration Server 8                 3

How to search and install package from repo on Red Hat Enterprise Linux 8.x

One can list all available packages under a repo named epel by typing the following command:
$ sudo yum --disablerepo="*" --enablerepo="epel" list available
OR use the grep command to filter out package names:
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | grep 'package'
$ sudo yum --disablerepo="*" --enablerepo="epel" list available | grep 'screen'

Here is the list:

Last metadata expiration check: 0:03:56 ago on Thursday 15 August 2019 08:13:35 AM UTC.
Available Packages
apachetop.x86_64                                             0.19.7-1.el8                                     epel
arj.x86_64                                                   3.10.22-30.el8                                   epel
beecrypt.x86_64                                              4.2.1-23.el8                                     epel
beecrypt-apidocs.x86_64                                      4.2.1-23.el8                                     epel
beecrypt-devel.x86_64                                        4.2.1-23.el8                                     epel
bgpdump.x86_64                                               1.6.0-2.el8                                      epel
bird.x86_64                                                  2.0.4-1.el8                                      epel
bird-doc.noarch                                              2.0.4-1.el8                                      epel
bodhi-client.noarch                                          4.0.2-2.el8.1                                    epel
bodhi-composer.noarch                                        4.0.2-2.el8.1                                    epel
bodhi-server.noarch                                          4.0.2-2.el8.1                                    epel
cc1541.x86_64                                                2.0-3.el8                                        epel
....
..
...
screen.x86_64                                                4.6.2-10.el8                                     epel
sendemail.noarch                                             1.56-4.el8                                       epel
sip-redirect.noarch                                          0.2.0-9.el8                                      epel
sshexport.noarch                                             2.4-1.el8                                        epel
tio.x86_64                                                   1.32-1.el8                                       epel
x509viewer.noarch                                            0.1.0-5.el8                                      epel
x509watch.noarch                                             0.6.1-6.el8                                      epel
zerofree.x86_64                                              1.1.1-3.el8                                      epel

Count packages

Use the following wc command to count packages:

echo -e "As of $(date) we have '$(sudo yum --disablerepo="*" --enablerepo="epel" list available | wc -l)' packages in this repo."

Which produces the following outputs on screen:

As of Mon Feb 15 00:27:19 EST 2021 we have '7006' packages in this repo.

Examples

For example, search a package named screen and install it on RHEL 8 using EPEL repo. The commands are as follows (see yum our command guide for more info).

Installing package using EPEL repo on RHEL 8

The syntax is as follows to search a package named screen:
$ sudo yum search screen

Next get more information about the screen:
$ sudo yum info screen

Finally, install the screen package on your Red Hat Enterprise Linux 8.x server or desktop/workstation system:
$ sudo yum install screen

Installing screen package on an RHEL 8 using epel repo command

Installing screen package on an RHEL 8 using yum command from epel repo

Conclusion

And, there you have it, a more significant number of packages to install from EPEL repo on Red Hat Enterprise Linux version 8.x. This repo gives us many high-quality free and open-source software packages that developers and uses can install on RHEL, CentOS, and Oracle Linux. Hence, we must enable it on a fresh installation. See repo home page here for more information. Do read the following docs or manual page using the --help option or man command:
$ man yum
$ yum --help

This entry is 4 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.

6 comments… add one
  • shariq khan Nov 30, 2020 @ 15:32

    Dear Team,

    while downloading the epel repository in rhel 8, getting below error…

    [root@rhel-app1 modprobe.d]# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

    Updating Subscription Management repositories.
    Unable to read consumer identity
    
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    
    Last metadata expiration check: 0:48:04 ago on Mon 30 Nov 2020 11:59:51 AM PST.
    [MIRROR] epel-release-latest-8.noarch.rpm: Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    [MIRROR] epel-release-latest-8.noarch.rpm: Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    [MIRROR] epel-release-latest-8.noarch.rpm: Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    [MIRROR] epel-release-latest-8.noarch.rpm: Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    [FAILED] epel-release-latest-8.noarch.rpm: Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    Curl error (6): Couldn't resolve host name for https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm [Could not resolve host: dl.fedoraproject.org]
    

    Regards
    Shariq

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Nov 30, 2020 @ 15:56

      Check your DNS name resolution. Can you ping or resolve hosts by names?

      host google.com
      ping yahoo.com

      If not set up correct nameservers names in /etc/resolv.conf. For example:

      # Generated by NetworkManager
      nameserver 192.168.2.250
      
    • Rohit Feb 23, 2021 @ 9:39

      You need to subscribe RHEL by paying or use devloper account to activate free subscription.

  • Wynne Chavez Jun 16, 2021 @ 12:29

    I was looking on how to enable the EPEL repository on RHEL 8 and this page was the best answer I found.

  • balaji May 13, 2023 @ 1:30

    ansible installation time i got below error how to solve this?

    [root@ip-172-31-21-28 ~]# yum install epel-release-latest-7.noarch.rpm
    Last metadata expiration check: 0:31:29 ago on Sat May 13 00:48:26 2023.
    Error:
    Problem: conflicting requests
    – nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages)

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite May 13, 2023 @ 7:27

      Try these two command:

      sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms

      And:

      sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.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.