Posted on
Administration

How to enable EPEL repository on RHEL-based systems

Author
  • User
    Linux Bash
    Posts by this author
    Posts by this author

How to Enable EPEL Repository on RHEL-Based Systems

Repositories in Linux serve as the central locations from which software packages are distributed and maintained. For Red Hat Enterprise Linux (RHEL) and its derivatives like CentOS, Rocky Linux, and AlmaLinux, the Extra Packages for Enterprise Linux (EPEL) repository is a crucial resource. It provides a set of additional packages that are not supplied by the base RHEL repositories, often maintained by the Fedora Project community.

Enabling the EPEL repository can greatly extend the range of available software, allowing users access to tools and applications that might not be provided by default. In this guide, we'll walk through the process of enabling the EPEL repository on RHEL-based systems. Note that RHEL-based systems commonly use the dnf or yum package managers, and do not natively use apt or zypper. However, we’ll briefly touch on considerations when working with other types of systems as well.

Before You Begin

You will need sudo privileges or root access to configure repositories on your system. Ensure that your system is registered and subscribes to Red Hat to have access to the base repositories, which is necessary for fetching EPEL packages as some of them depend on packages from these repositories.

Step 1: Check Your Distribution

First, verify which version of RHEL-based distribution you are using. This information will help in determining the right EPEL repository version for your system. You can check your system version by running:

cat /etc/os-release

Or for older distributions, you might need:

cat /etc/redhat-release

Step 2: Enable EPEL Repository

On RHEL/CentOS 7 and Later

  1. Install the EPEL repository package:

    For CentOS and RHEL 7 and newer, you can enable the EPEL repository by installing a specific package available in the default repository. Run:

    sudo yum install epel-release
    

    or, if your system uses dnf:

    sudo dnf install epel-release
    

    This command installs the EPEL repository configuration along with the necessary GPG keys used to verify the integrity of the packages.

  2. Verify the repository has been enabled

    Check that the EPEL repository is enabled by listing all enabled repositories:

    yum repolist enabled | grep epel
    

    or

    dnf repolist enabled | grep epel
    

    You should see entries indicating that the EPEL repository is enabled.

On RHEL/CentOS 8 when using DNF

If you are using RHEL 8 or CentOS 8, dnf is used instead of yum (though yum commands will still work via the compatibility layer):

  1. Enable EPEL repo using DNF:

    sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    
  2. Enable the EPEL Modular repository (optional):

    This step is optional and provides additional modular packages:

    sudo dnf config-manager --set-enabled epel-modular
    

Step 3: Install Packages from EPEL

Now that EPEL is enabled, you can install packages from it just like any other package:

sudo dnf install <package-name>

Replace <package-name> with the name of the package you wish to install.

Special Notes on Other Package Managers

  • Apt: RHEL-based systems do not use apt (used by Debian-based systems). If you are working on a Debian/Ubuntu system, you’ll interact with different repositories (not EPEL).

  • Zypper: Similarly, zypper is the default package manager for openSUSE systems and is not used in RHEL-based environments.

Conclusion

Enabling the EPEL repository on your RHEL-based system expands your software options and helps ensure that you have access to necessary tools that are not available in the base repository. With EPEL enabled, you can maintain the robustness and stability of your system while leveraging the vast array of additional packages provided by the Fedora community. As always, assess package sources and ensure you trust the repositories enabled on your systems. Happy computing!