How to install the extra repositories such as Fedora EPEL repo on a Red Hat Enterprise Linux server version 8.x or CentOS Linux server version 8.x? How to install EPEL repo in RHEL 8 Linux. How to install EPEL repo in CentOS 8 Linux.

What is EPEL repo?
Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).
EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions. EPEL uses much of the same infrastructure as Fedora, including buildsystem, bugzilla instance, updates manager, mirror manager and more.
You can check the mirror list to get the list of repositories available at EPEL
Install EPEL repo in RHEL 8
The EPEL Repo contains all the packages and EPEL rpms which can be used to install epel repo in RHEL 8 Linux host.
So one can manually install the EPEL repo rpm using DNF/YUM/RPM.
[root@rhel-8 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
warning: /var/tmp/rpm-tmp.URDkYa: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-8-1 ################################# [100%]
epel-release-latest-8.noarch.rpm)
is changed then you can manually navigate to
EPEL Mirror Repo for Red
Hat and download the latest available RPM version suitable for
RHEL 8.
While working on EPEL repo I found a BUG while trying to setup my repository “Failed to synchronize cache for repo ’epel’, ignoring this repo.”
How to fix “Failed to synchronize cache for repo ’epel’, ignoring this repo.” ?
After you install EPEL repo in RHEL 8 Linux it is a good idea to clean up the existing cache
[root@rhel-8 ~]# dnf clean all
Updating Subscription Management repositories.
16 files removed
[root@rhel-8 ~]# rm -rf /var/cache/dnf
Next you can check the list of available repo on your Linux host using below command
[root@rhel-8 ~]# dnf repolist
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux $release - x86_64 23 kB/s | 51 kB 00:02
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 2.2 MB/s | 8.6 MB 00:03
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 966 kB/s | 5.6 MB 00:05
Failed to synchronize cache for repo 'epel', ignoring this repo.
Last metadata expiration check: 0:00:03 ago on Sat 03 Aug 2019 12:12:13 AM IST.
repo id repo name status
rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 5,693
rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 2,078
But as you see here I get an error “Failed to synchronize cache for
repo ’epel’, ignoring this repo.” Then another thing worth noticing is
the Repo Name for EPEL, which instead of containing the release version,
it still contains a variable $release which I assumed can be the cause
of this problem
To re-confirm this I also checked their
EPEL source rpm
which also contained the same file wherein they have either
missed to change the
$Release variable or this contains a
newer way to handle the
variable but not properly implemented.
I assume since RHEL 8 is recently released, this is still in BETA and a more stable EPEL repo will be released in future.
But for now to overcome the situation you can manually change this
variable in /etc/yum.repos.d/epel.repo as highlighted below
[epel]
name=Extra Packages for Enterprise Linux $release - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/$release/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$release&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$release
TO
[epel]
name=Extra Packages for Enterprise Linux 8 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/$release/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
epel.repo content and
rebuild
a new epel rpm using the source rpm content. But make sure
you check their
GPL license before
any such manual customised rpm is used in production environment.
Next clean the existing repo cache and check the list of available repo
[root@rhel-8 ~]# dnf clean all
Updating Subscription Management repositories.
27 files removed
[root@rhel-8 ~]# rm -rf /var/cache/dnf
[root@rhel-8 ~]# dnf repolist
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 8 - x86_64 98 kB/s | 430 kB 00:04
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 1.5 MB/s | 8.6 MB 00:05
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 1.2 MB/s | 5.6 MB 00:04
repo id repo name status
*epel Extra Packages for Enterprise Linux 8 - x86_64 310
rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 5,693
rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 2,078
So now our EPEL repo is working on RHEL 8 Linux host.
Next you can verify the list of available RPMS under EPEL repo for RHEL 8
[root@rhel-8 ~]# dnf list | grep epel | less
epel-release.noarch 8-1 @System
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
<output trimmed>
So with this we know that the current release of EPEL repo for RHEL 8 is not very stable and our manual workaround can fix “Failed to synchronize cache for repo ’epel’, ignoring this repo.”.
Hopefully the future releases will have more stable version.
Lastly I hope the steps from the article to install EPEL repo in RHEL 8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.


