Tuesday, April 27, 2021

Enable EPEL on RHEL 8

Reference: https://linuxconfig.org/redhat-8-epel-install-guide


 [root@rhel83 ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.


Last metadata expiration check: 1:00:26 ago on Wed 28 Apr 2021 10:06:22 AM +08.

epel-release-latest-8.noarch.rpm                                                                                             18 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 products updated.


Installed:

  epel-release-8-10.el8.noarch


Complete!

[root@rhel83 ~]# rpm -ql epel-release

/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@rhel83 ~]# dnf repolist -v

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.


DNF version: 4.2.23

cachedir: /var/cache/dnf

Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                                                                                       386 kB/s | 557 kB     00:01

Extra Packages for Enterprise Linux 8 - x86_64                                                                                                                                                               1.0 MB/s | 9.3 MB     00:09

Repo-id            : LocalRepo_AppStream

Repo-name          : LocalRepository_AppStream

Repo-revision      : 1602239687

Repo-updated       : Fri 09 Oct 2020 06:34:17 PM +08

Repo-pkgs          : 5,802

Repo-available-pkgs: 5,072

Repo-size          : 7.1 G

Repo-baseurl       : file:///run/media/mars/RHEL-8-3-0-BaseOS-x86_64/AppStream

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 10:06:22 AM +08)

Repo-filename      : /etc/yum.repos.d/local.repo


Repo-id            : LocalRepo_BaseOS

Repo-name          : LocalRepository_BaseOS

Repo-revision      : 1602239724

Repo-updated       : Fri 09 Oct 2020 06:34:52 PM +08

Repo-pkgs          : 1,696

Repo-available-pkgs: 1,694

Repo-size          : 1.1 G

Repo-baseurl       : file:///run/media/mars/RHEL-8-3-0-BaseOS-x86_64/BaseOS

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 10:06:22 AM +08)

Repo-filename      : /etc/yum.repos.d/local.repo


Repo-id            : epel

Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64

Repo-revision      : 1619485425

Repo-updated       : Tue 27 Apr 2021 09:04:16 AM +08

Repo-pkgs          : 7,300

Repo-available-pkgs: 7,297

Repo-size          : 10 G

Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir

  Updated          : Wed 28 Apr 2021 11:09:09 AM +08

Repo-baseurl       : http://mirror.earthlink.iq/epel/8/Everything/x86_64/ (27 more)

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 11:09:09 AM +08)

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      : 1617810544

Repo-updated       : Wed 07 Apr 2021 11:49:16 PM +08

Repo-pkgs          : 120

Repo-available-pkgs: 0

Repo-size          : 412 M

Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=$infra&content=$contentdir

  Updated          : Wed 28 Apr 2021 11:09:04 AM +08

Repo-baseurl       : rsync://download.nus.edu.sg/epel/8/Modular/x86_64/ (60 more)

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 11:09:04 AM +08)

Repo-filename      : /etc/yum.repos.d/epel-modular.repo

Total packages: 14,918

[root@rhel83 ~]#


Enable repository on RHEL8

 Reference: https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-create-local-yum-repository-on-rhel-8-using-dvd.html


New Repository in RHEL 8

Red Hat Enterprise Linux 8 is split across two repositories,

  1. BaseOS
  2. Application Stream (AppStream)

Packages in BaseOS is intended to provide the core set of the underlying OS functionality that provides the foundation for all type installations.

Packages in Application Stream includes user space applications, runtime languages, and databases in support of the varied workloads and use cases.

Create Source

Repository’s source can be created either using the createrepo package or mounting the DVD on the directory. Mounting the DVD/CD ROM will help you save the space on HDD used by being copied to HDD.

Here, mount the DVD ROM on any directory of your wish. For testing, I will mount it on /cdrom.

mkdir /cdrom
mount /dev/cdrom /cdrom

Create a .repo file

Before creating a <name>.repo file, move the existing files present in /etc/yum.repos.d/directory to/tmp, if no longer required.

mv /etc/yum.repos.d/*.repo /tmp/

Create a repo file called local.repo under /etc/yum.repos.d directory.

vi /etc/yum.repos.d/local.repo

Base OS

[LocalRepo_BaseOS]
name=LocalRepository_BaseOS
baseurl=file:///cdrom/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

App Stream

[LocalRepo_AppStream]
name=LocalRepository_AppStream
baseurl=file:///cdrom/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Details:

[LocalRepo]Name of the Section
nameName of the repository
baseurlLocation of the package
EnabledEnable repository
gpgcheckEnable secure installation (gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
gpgkeyLocation of the key

Install Packages from Local YUM repository

Clear the repository cache by running the following command.
yum clean all

Let’s install the telnet package from the local repository.

yum install vsftpd

The output will be like below.

When you give yes to download the package, it will prompt you to accept gpg signing key.

LocalRepository_AppStream                       3.1 MB/s | 3.2 kB     00:00
LocalRepository_BaseOS                          2.7 MB/s | 2.7 kB     00:00
Dependencies resolved.
================================================================================
 Package      Arch         Version              Repository                 Size
================================================================================
Installing:
 vsftpd       x86_64       3.0.3-28.el8         LocalRepo_AppStream       180 k

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

Total size: 180 k
Installed size: 356 k
Is this ok [y/N]: y
Downloading Packages:
warning: /cdrom/AppStream/Packages/vsftpd-3.0.3-28.el8.x86_64.rpm: Header V3 RSA                                                                                                             /SHA256 Signature, key ID fd431d51: NOKEY
LocalRepository_AppStream                       177 kB/s | 5.0 kB     00:00
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <security@redhat.com>"
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0xD4082792:
 Userid     : "Red Hat, Inc. (auxiliary key) <security@redhat.com>"
 Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : vsftpd-3.0.3-28.el8.x86_64                             1/1
  Running scriptlet: vsftpd-3.0.3-28.el8.x86_64                             1/1
  Verifying        : vsftpd-3.0.3-28.el8.x86_64                             1/1
Installed products updated.

Installed:
  vsftpd-3.0.3-28.el8.x86_64

Complete!

Conclusion