How To Create Local YUM Repository on RHEL 8 using DVD

0

Local YUM repository is the place where the rpm packages for Redhat or CentOS are stored and distributed to client servers for software installation and OS updates.

This local repository lets you save internet bandwidth as well the time for downloading packages from the internet.

Here, we will go through steps to create local YUM repository on RHEL 8 for RHEL 8 using DVD.

This repository is limited to a single machine where the DVD is mounted.

New 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-beta

Details:

[LocalRepo] Name of the Section
name Name of the repository
baseurl Location of the package
Enabled Enable repository
gpgcheck Enable secure installation (gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
gpgkey Location 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                                                     2.8 kB/s | 2.8 kB     00:01
LocalRepository_BaseOS                                                        2.7 kB/s | 2.7 kB     00:01
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 f21541eb: NOKEY
LocalRepository_AppStream                                                     3.2 kB/s | 3.3 kB     00:01
Importing GPG key 0xF21541EB:
 Userid     : "Red Hat, Inc. (beta key 2) <security@redhat.com>"
 Fingerprint: B08B 659E E86A F623 BC90 E8DB 938A 80CA F215 41EB
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0x897DA07A:
 Userid     : "Red Hat, Inc. (Beta Test Software) <rawhide@redhat.com>"
 Fingerprint: 17E8 543D 1D4A A5FA A96A 7E9F FD37 2689 897D A07A
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
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
Installed: vsftpd-3.0.3-28.el8.x86_64
  Installing       : vsftpd-3.0.3-28.el8.x86_64                                                           1/1
  Running scriptlet: vsftpd-3.0.3-28.el8.x86_64                                                           1/1
Installed: vsftpd-3.0.3-28.el8.x86_64
  Verifying        : vsftpd-3.0.3-28.el8.x86_64                                                           1/1

Installed:
  vsftpd-3.0.3-28.el8.x86_64

Complete!

You have successfully configured the local yum repository on the machine.

That’s All.

Further Reading

You might also like

How To Create Local YUM Repository on RHEL 8 using DVD

0