How To enable the EPEL Repository on RHEL 8 / CentOS 8 Linux
[Info] Checking the EPEL repository...
[Error] Install EPEL repository failed, please check it.

[root@ip-172-31-41-9 opt]# rpm -ql epel-release
package epel-release is not installed
[root@ip-172-31-41-9 opt]# 
Installing the configuration package

Enabling the EPEL8 repository on RHEL 8 / CentOS 8 is very simple: all we need to do is to download and install the configuration package which contains the repository files. The file is available for download at the following address . For the sake of this tutorial I will assume we are operating from the command line interface. We don’t need to download the package to install it: we can perform the operation directly using dnf package manager:

$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

We just use dnf with the install sub-command, and provide the URL of the package (in this case we used the https protocol). Once we run the command above an overview of the operations that would be performed is displayed, and we are prompted to confirm that we want to install the package:

[root@ip-172-31-41-9 opt]# sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Last metadata expiration check: 0:55:05 ago on Tue 05 Jan 2021 05:01:02 AM UTC.
epel-release-latest-8.noarch.rpm                                                                                                                                                   21 kB/s |  22 kB     00:01    
Dependencies resolved.
==================================================================================================================================================================================================================
 Package                                              Architecture                                   Version                                           Repository                                            Size
==================================================================================================================================================================================================================
Installing:
 epel-release                                         noarch                                         8-10.el8                                          @commandline                                          22 k

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 22 k
Installed size: 32 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-8-10.el8.noarch                                                                                                                                                             1/1 
  Running scriptlet: epel-release-8-10.el8.noarch                                                                                                                                                             1/1 
  Verifying        : epel-release-8-10.el8.noarch                                                                                                                                                             1/1 

Installed:
  epel-release-8-10.el8.noarch                                                                                                                                                                                    

Complete!
[root@ip-172-31-41-9 opt]#

If we confirm by typing “y” and pressing enter, the package will be installed. It contains the files needed to configure the additional software sources. To see where those files have been installed, we can run the following command:

$ sudo rpm -ql epel-release

In the command above, the -q option is the short for --query, while -l is short for --list, and is used to list the files contained in a package. The command above produces the following output:

/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
/etc/yum.repos.d/epel-modular.repo
/etc/yum.repos.d/epel-playground.repo
/etc/yum.repos.d/epel-testing-modular.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/epel.repo
/usr/lib/systemd/system-preset/90-epel.preset
/usr/share/doc/epel-release
/usr/share/doc/epel-release/GPL
/usr/share/doc/epel-release/README-epel-8-packaging.md
[root@ip-172-31-41-9 opt]# 

Apart from the documentation files and the repository public gpg key, we can see that three repository configuration files have been installed, they are the files with the .repo extension: epel, epel-playground and epel-testing. The first one is the main repository, the one which is enabled by default, the other two contain experimental version of software packages and must be enabled explicitly. To verify that the EPEL repository has been enabled we can run:

$ sudo dnf repolist -v

The command, if invoked as above, displays a list of all repositories enabled in the system (it can also be used to display only the disabled ones or all the repositories existing in the system). By providing the -v option, (short for --verbose), we can obtain a more detailed report:

[root@ip-172-31-41-9 opt]# sudo dnf repolist -v
Loaded plugins: AmazonID, builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, uploadprofile
DNF version: 4.2.23
cachedir: /var/cache/dnf
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                                                            672 kB/s | 527 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                                                                                    9.5 MB/s | 8.7 MB     00:00    
Repo-id            : epel
Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64
Repo-revision      : 1609810574
Repo-updated       : Tue 05 Jan 2021 01:37:50 AM UTC
Repo-pkgs          : 6,883
Repo-available-pkgs: 6,879
Repo-size          : 9.8 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir
  Updated          : Tue 05 Jan 2021 06:04:18 AM UTC
Repo-baseurl       : https://d2lzkl7pfhq30w.cloudfront.net/pub/epel/8/Everything/x86_64/ (29 more)
Repo-expire        : 172,800 second(s) (last: Tue 05 Jan 2021 06:04:18 AM UTC)
Repo-filename      : /etc/yum.repos.d/epel.repo

Repo-id            : epel-modular
Repo-name          : Extra Packages for Enterprise Linux Modular 8 - x86_64
Repo-revision      : 1609464703
Repo-updated       : Fri 01 Jan 2021 01:32:01 AM UTC
Repo-pkgs          : 105
Repo-available-pkgs: 0
Repo-size          : 450 M
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=$infra&content=$contentdir
  Updated          : Tue 05 Jan 2021 06:04:17 AM UTC
Repo-baseurl       : https://d2lzkl7pfhq30w.cloudfront.net/pub/epel/8/Modular/x86_64/ (57 more)
Repo-expire        : 172,800 second(s) (last: Tue 05 Jan 2021 06:04:17 AM UTC)
Repo-filename      : /etc/yum.repos.d/epel-modular.repo

Repo-id            : rhel-8-appstream-rhui-rpms
Repo-name          : Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs)
Repo-revision      : 1609786801
Repo-updated       : Mon 04 Jan 2021 07:01:54 PM UTC
Repo-pkgs          : 15,303
Repo-available-pkgs: 13,654
Repo-size          : 34 G
Repo-mirrors       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel8/rhui/8/x86_64/appstream/os
Repo-baseurl       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/repos/content/dist/rhel8/rhui/8/x86_64/appstream/os (0 more)
Repo-expire        : 172,800 second(s) (last: Tue 05 Jan 2021 05:01:02 AM UTC)
Repo-filename      : /etc/yum.repos.d/redhat-rhui.repo

Repo-id            : rhel-8-baseos-rhui-rpms
Repo-name          : Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs)
Repo-revision      : 1609807093
Repo-updated       : Tue 05 Jan 2021 12:40:15 AM UTC
Repo-pkgs          : 6,251
Repo-available-pkgs: 6,248
Repo-size          : 8.9 G
Repo-mirrors       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/mirror/content/dist/rhel8/rhui/8/x86_64/baseos/os
Repo-baseurl       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/repos/content/dist/rhel8/rhui/8/x86_64/baseos/os (0 more)
Repo-expire        : 172,800 second(s) (last: Tue 05 Jan 2021 05:01:02 AM UTC)
Repo-filename      : /etc/yum.repos.d/redhat-rhui.repo

Repo-id            : rhui-client-config-server-8
Repo-name          : Red Hat Update Infrastructure 3 Client Configuration Server 8
Repo-revision      : 1597675509
Repo-updated       : Mon 17 Aug 2020 02:45:09 PM UTC
Repo-pkgs          : 11
Repo-available-pkgs: 11
Repo-size          : 376 k
Repo-mirrors       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/mirror/protected/rhui-client-config/rhel/server/8/x86_64/os
Repo-baseurl       : https://rhui3.ap-northeast-1.aws.ce.redhat.com/pulp/repos/protected/rhui-client-config/rhel/server/8/x86_64/os (0 more)
Repo-expire        : 172,800 second(s) (last: Tue 05 Jan 2021 05:01:02 AM UTC)
Repo-filename      : /etc/yum.repos.d/redhat-rhui-client-config.repo
Total packages: 28,553
[root@ip-172-31-41-9 opt]# 

As we can see from the output of the command, the repository has been correctly activated, it is the first one in the list.

List the packages contained in the EPEL8 repository

Once we install and enable the EPEL repository, we can take advantage of the additional software packages it provides, installing them as usual. But what if we want to know all the packages contained in the repository? Once again, all we must do is to use dnf providing the repo_id of the repository we want to inspect, “epel” in this case:

$ sudo dnf repository-packages epel list

Here is an excerpt of the command result:

[root@ip-172-31-41-9 opt]# sudo dnf repository-packages epel list
Last metadata expiration check: 0:07:03 ago on Tue 05 Jan 2021 06:04:18 AM UTC.
Available Packages
3proxy.x86_64                                                                                                0.8.13-1.el8                                                                                     epel
AusweisApp2.x86_64                                                                                           1.20.2-10.el8                                                                                    epel
AusweisApp2-data.noarch                                                                                      1.20.2-10.el8                                                                                    epel
AusweisApp2-doc.noarch                                                                                       1.20.2-10.el8                                                                                    epel
BackupPC.x86_64                                                                                              4.4.0-1.el8                                                                                      epel
BackupPC-XS.x86_64                                                                                           0.62-1.el8                                                                                       epel
BibTool.x86_64                                                                                               2.68-1.el8                                                                                       epel
CCfits.x86_64                                                                                                2.5-14.el8                                                                                       epel
CCfits-devel.x86_64                                                                                          2.5-14.el8                                                                                       epel
CCfits-doc.noarch                                                                                            2.5-14.el8                                                                                       epel
CGSI-gSOAP.x86_64                                                                                            1.3.11-7.el8                                                                                     epel
CGSI-gSOAP-devel.x86_64                                                                                      1.3.11-7.el8                                                                                     epel
Field3D.x86_64                                                                                               1.7.2-16.el8                                                                                     epel
Field3D-devel.x86_64                                                                                         1.7.2-16.el8                                                                                     epel
FoXlibf.x86_64                                                                                               4.1.2-12.el8                                                                                     epel
FoXlibf-devel.x86_64                                                                                         4.1.2-12.el8                                                                                     epel
[...]

As we can see from the output of the command, a lot of software usually provided by the EPEL channel is still missing from the repository, as for example packages needed to install alternative desktop environments like Xfce4 or utilities like phpMyAdmin (check our tutorial about installing it from source, as an alternative). Those packages will be probably provided in the future.

Logo

更多推荐