Sign In
Sign In

How to Add the EPEL Repository to CentOS and AlmaLinux

How to Add the EPEL Repository to CentOS and AlmaLinux
Hostman Team
Technical writer
Linux
12.07.2024
Reading time: 5 min

Red Hat produces one of the most popular Linux distributions, Red Hat Enterprise Linux (RHEL). This commercial distribution requires a costly license for use on servers or workstations. 

Since RHEL development is based on open technologies and free licenses, which require the developer company to share the source code with the community, several free distributions have emerged that support binary compatibility with the American IT giant's product.These distributions include CentOS, AlmaLinux, Rocky, Oracle Linux, and several lesser-known ones. 

You can easily install a cloud server with CentOS in the Hostman control panel:

  1. Go to the Cloud Servers section and click the Create server button.

  2. Choose CentOS (versions 7 and 9 are available).

  3. Configure the additional parameters described in the guide on creating cloud servers, and start the server.

Since the Red Hat Enterprise Linux distribution undergoes more thorough testing, its repositories store a limited list of packages. However, we often need to install additional packages that are not available in the standard RHEL repositories. This is where the Extra Packages for Enterprise Linux (EPEL) repository comes to our aid.

EPEL packages include modules for Python, Perl, Ruby gems, and other additions for various programming languages. You will also find utilities like etckeeper, ImageMagick, and GraphicsMagick, as well as builds of the Chromium browser. And this is far from a complete list.

What is Extra Packages for Enterprise Linux (EPEL)?

The EPEL project aims to make packages from the Fedora Linux distribution available in RHEL and its derivatives. Fedora, or Fedora Linux, is a distribution developed by the community with commercial support from Red Hat and IBM. Fedora is considered to contain features that are planned for future use in Red Hat Enterprise Linux. This is why Fedora Linux is often called the "RHEL testing ground," although it is one of the distributions that successfully balances stability and new features. There are reports that Linux kernel author Linus Torvalds uses Fedora Linux.

How to Add the EPEL Repository

Currently, the EPEL repository supports three versions — EL7, EL8, and EL9. These numbers correspond to the major versions of the distributions. Many RHEL-based distributions already include installation packages for EPEL in their repositories. Installing such a package will add the EPEL repository to the system.

The following commands will install the corresponding version of the EPEL repository depending on the distribution used.

EL9

For CentOS Stream 9, use:

dnf config-manager --set-enabled crb
dnf install epel-release epel-next-release

To add the EPEL repo to AlmaLinux 9, use:

dnf config-manager --set-enabled crb
dnf install epel-release

EL8

CentOS Stream 8

dnf config-manager --set-enabled powertools
dnf install epel-release epel-next-release

AlmaLinux 8

dnf config-manager --set-enabled powertools
dnf install epel-release

EL7

If you wish to add the EPEL repo to CentOS 7, run:

yum install epel-release

How to Search and Install Packages from the EPEL Repository

To search and install packages from the EPEL repository, we will use the DNF utility or, if using CentOS 7, its predecessor — the YUM program. For example, to find all packages from the EPEL repository with "nginx" in the name, summary, or full description, run the following command:

dnf search --disablerepo='*' --enablerepo='epel' nginx

Or, if you have CentOS 7:

yum search --disablerepo='*' --enablerepo='epel' nginx

Image5

To install packages, use the command dnf install <package_name> or yum install <package_name> in a CentOS 7 system. The EPEL repository is complementary, meaning it only provides additional packages not included in the system's standard supply. Therefore, no extra parameters indicating that the package needs to be installed specifically from the EPEL repository are required.

How Safe is it to Use Packages from the EPEL Repository?

The EPEL project strives to provide stable, high-quality packages. However, the repository is supported by the community on a voluntary basis, and commercial support is not provided. It is important to exercise caution when using packages from third-party repositories. This also applies to the EPEL repository. It is possible that such packages have not been as thoroughly tested and verified as packages from the official distribution repositories. Users should always read the package documentation, check its integrity, and ensure it meets their specific requirements before installing it in their system.

What if the Package I Need is Not in EPEL?

Before a package appears in the EPEL repository, it must be in the Fedora Linux repository. However, there are situations where a package is in the Fedora Linux repository but not in the EPEL repository. This is normal since the EPEL repository is not a rebuild of all Fedora packages for RHEL-based distributions. If you want a package to appear in the EPEL repository, you need to submit a request to add such a package. Detailed instructions are available on the EPEL project's documentation page.

Conclusion

In this article, you learned about the EPEL additional package repository for Red Hat Enterprise Linux (RHEL)-based operating systems such as CentOS and AlmaLinux. You learned how to add the EPEL repository to CentOS and AlmaLinux, search for, and install packages from this repository. 

Linux
12.07.2024
Reading time: 5 min

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start
Email us