EPEL (Extra Packages for Enterprise Linux) is the repository that provides a number of additional packages for RHEL (Rocky Linux, AlmaLinux, CentOS and others) from Fedora sources. The packages included in this repository were developed by the Fedora developer community group.
There are 2 different methods to add the EPEL repository. The first of these is to add the EPEL repository by installing the epel-release package from the Rocky Linux repositories. The second is to manually install the epel-release.rpm package on the system. Let's started.
Method-1: Package Installation From Repository
View the repositories in the system before installing the package from the repository:
[foc@rocky9 ~]$ sudo dnf repolist repo id repo name appstream Rocky Linux 9 - AppStream baseos Rocky Linux 9 - BaseOS extras Rocky Linux 9 - Extras
Standard Rocky Linux repositories are available. To add the EPEL repo to Rocky Linux, it is necessary to install the following package:
[foc@rocky9 ~]$ sudo dnf install epel-release
Last metadata expiration check: 0:12:20 ago on Sun 25 Dec 2022 09:57:55 PM +03.
Dependencies resolved.
========================================================================
Package Architecture Version Repository Size
========================================================================
Installing:
epel-release noarch 9-4.el9 extras 19 k
Transaction Summary
========================================================================
Install 1 Package
Total download size: 19 k
Installed size: 25 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-9-4.el9.noarch.rpm 49 kB/s | 19 kB 00:00
------------------------------------------------------------------------
Total 18 kB/s | 19 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-9-4.el9.noarch 1/1
Running scriptlet: epel-release-9-4.el9.noarch 1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
Verifying : epel-release-9-4.el9.noarch 1/1
Installed:
epel-release-9-4.el9.noarch
Complete!
Pull the repository list after package installation:
[foc@rocky9 ~]$ sudo dnf repolist
repo id repo name
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
epel Extra Packages for Enterprise Linux 9 - x86_64
extras Rocky Linux 9 - Extras
You can see that the "Extra Packages for Enterprise Linux 9" repository is active on the system.
Method-2: Adding a Repository by installing EPEL RPM package
For the EPEL repository on RHEL-based systems, there may be systems that do not keep RPM packages in their repositories. In fact, many distributions did not have this package in their repositories before. The RPM package needs to be manually downloaded and installed on the system.
View package repositories before installation:
[foc@rocky9 ~]$ sudo dnf repolist repo id repo name appstream Rocky Linux 9 - AppStream baseos Rocky Linux 9 - BaseOS extras Rocky Linux 9 - Extras
Below is the RPM package link for 3 different RHEL versions:
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Since we will add the EPEL repository to Rocky Linux 9, we install the RPM package to the system using the first link:
[foc@rocky9 ~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
Rocky Linux 9 - BaseOS 3.4 kB/s | 3.6 kB 00:01
Rocky Linux 9 - BaseOS 2.0 MB/s | 1.7 MB 00:00
Rocky Linux 9 - AppStream 8.7 kB/s | 4.1 kB 00:00
Rocky Linux 9 - AppStream 2.3 MB/s | 6.4 MB 00:02
Rocky Linux 9 - Extras 6.6 kB/s | 2.9 kB 00:00
Rocky Linux 9 - Extras 7.5 kB/s | 6.6 kB 00:00
epel-release-latest-9.noarch.rpm 29 kB/s | 18 kB 00:00
Dependencies resolved.
========================================================================
Package Architecture Version Repository Size
========================================================================
Installing:
epel-release noarch 9-4.el9 @commandline 18 k
Transaction Summary
========================================================================
Install 1 Package
Total size: 18 k
Installed size: 25 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-9-4.el9.noarch 1/1
Running scriptlet: epel-release-9-4.el9.noarch 1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
Verifying : epel-release-9-4.el9.noarch 1/1
Installed:
epel-release-9-4.el9.noarch
Complete!
After installation the repositories are:
[foc@rocky9 ~]$ sudo dnf repolist
repo id repo name
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
epel Extra Packages for Enterprise Linux 9 - x86_64
extras Rocky Linux 9 - Extras
The ".repo
" files related to the EPEL repository are located under the /etc/yum.repos.d/
directory. You can do edit it manually from here:
[foc@rocky9 ~]$ ls -la /etc/yum.repos.d/epel*
-rw-r--r--. 1 root root 1453 Aug 10 16:11 /etc/yum.repos.d/epel.repo
-rw-r--r--. 1 root root 1552 Aug 10 16:11 /etc/yum.repos.d/epel-testing.repo
The epel-release package version in Rocky Linux 8:
[foc@rockylinux8 ~]$ sudo dnf list installed | grep epel-release
epel-release.noarch 8-18.el8 @extras
Package version in Rocky Linux 9:
[foc@rocky9 ~]$ sudo dnf list installed | grep epel-release
epel-release.noarch 9-4.el9 @extras
How to Enable EPEL Repo
If the EPEL repo is disabled in Rocky Linux, you can enable it with the following command:
[foc@rockylinux8 ~]$ sudo dnf config-manager --set-enabled epel
You can see EPEL in the repo list:
[foc@rocky9 ~]$ sudo dnf repolist
repo id repo name
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
epel Extra Packages for Enterprise Linux 9 - x86_64
How to Disable EPEL Repo
To disable the EPEL repository:
[foc@rocky9 ~]$ sudo dnf config-manager --set-disabled epel
You can see that the EPEL repository is disabled:
[foc@rocky9 ~]$ sudo dnf repolist repo id repo name appstream Rocky Linux 9 - AppStream baseos Rocky Linux 9 - BaseOS extras Rocky Linux 9 - Extras
After this step, the ".repo" files under the /etc/yum.repos.d
directory are not deleted, only the "enabled" value in it is changed to 0 for all the respective repos.
Summary
In this article, we explained the steps to add an EPEL repository to Rocky Linux. You can get help about other Rocky Linux repository here(Rocky Linux Repositories).
References
docs.fedoraproject.org - Extra Packages for Enterprise Linux (EPEL)