In this short how-to guide, we are about to see how to create a local yum repository using RHEL 8 ISO. Like previous RHEL distributions if we plan to create a local yum repo it won’t work as expected. It may throw an error for dependencies while trying to install any packages. This may help someone who looking for how to create one in RHEL 8.
RedHat Enterprise Linux 8 comes with two repositories they are “BaseOS” packages and “AppStream” packages. In our below repository configuration, we have two repository information.
BaseOS Repository will contain packages like OS installation packages (Core Packages), Administrative tools packages and their dependencies. You can navigate to location /mnt/BaseOS/Packages to have a look.
AppStream Repository will have all remaining packages like vim, PostgreSQL, MariaDB, Maven, Bind, LibreOffice and all other application and OS related dependencies under /mnt/AppStream/Packages.
You may be interested in RHEL 8 Related Articles.
- Installing RedHat Enterprise Linux 8.0 with screenshots
- Using AppStream with yum in Red Hat Enterprise Linux 8
- Stratis to create layered storage in RedHat Enterprise Linux 8
- Setup an iSCSI Target Server and Initiator on RHEL 7.x / RHEL 8
Let us begin with creating a local Yum Repo.
In your case, if you need to mount the DVD-ROM or mounted ISO in your virtual machine follow the below steps. For demonstration purpose, we are mounting under /mnt.
# mount /dev/sr0 /mnt/
Creating a Yum Repository file
Navigate to the usual repository file location and create a file in any name. In my case, I’m creating as local.repo.
# cd /etc/yum.repos.d/ # vi local.repo
Append with below entry into your created file.
[rhel8_BaseOS] name=rhel8_BaseOS baseurl=file:///mnt/BaseOS enabled=1 gpgcheck=1 gpgkey=file:///mnt/RPM-GPG-KEY-redhat-release [rhel8_AppStream] name=rhel8_AppStream baseurl=file:///mnt/AppStream enabled=1 gpgcheck=1 gpgkey=file:///mnt/RPM-GPG-KEY-redhat-release
Let’s see what are the above line means.
- A name of Repository
- BaseURL from which location the packages need to be downloaded.
- Whether the Repo is enabled or not. 0 is Disabled, 1 is Enabled.
- While installing a package whether it needs to check for GPG key.
- Which key needs to be used to verify the packages.
We have locally mounted the ISO/DVD so the BaseURL should start as file:// by following mount point and path of Repository. The GPG key for RHEL 8 resides under the root (/) of the ISO file.
Read about how to use AppStream on RHEL 8.
Listing the Created Yum Repository
List the repository using yum or dnf.
# yum repolist all # dnf repolist
Now it’s time to verify by installing any one of the packages.
# dnf install tcpdump -y # yum install tcpdump -y
If the package installed without throwing any error we are good with configuring a local yum repository.
[root@rhel8 ~]# [root@rhel8 ~]# dnf install tcpdump 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: 0:05:57 ago on Thu 09 May 2019 07:33:22 PM IST. Dependencies resolved. Package Arch Version Repository Size Installing: tcpdump x86_64 14:4.9.2-5.el8 rhel8_AppStream 477 k Transaction Summary Install 1 Package Total size: 477 k Installed size: 1.3 M Is this ok [y/N]: y Downloading Packages: warning: /mnt/AppStream/Packages/tcpdump-4.9.2-5.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY rhel8_AppStream 2.9 MB/s | 5.0 kB 00:00 Importing GPG key 0xFD431D51: Userid : "Red Hat, Inc. (release key 2) firstname.lastname@example.org" Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51 From : /mnt/RPM-GPG-KEY-redhat-release Is this ok [y/N]: y Key imported successfully Importing GPG key 0xD4082792: Userid : "Red Hat, Inc. (auxiliary key) email@example.com" Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792 From : /mnt/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 Running scriptlet: tcpdump-14:4.9.2-5.el8.x86_64 1/1 Installing : tcpdump-14:4.9.2-5.el8.x86_64 1/1 Running scriptlet: tcpdump-14:4.9.2-5.el8.x86_64 1/1 Verifying : tcpdump-14:4.9.2-5.el8.x86_64 1/1 Installed products updated. Installed: tcpdump-14:4.9.2-5.el8.x86_64 Complete! [root@rhel8 ~]#
That’s it we have successfully created a Yum local repository in RedHat Enterprise Linux 8 Server.
We have created an RHEL 8 local yum repository using ISO file. This will help for someone who looking to figure out how to install a few packages without a valid RHEL subscription. Let us come up with another article until subscribe to our newsletter to keep you updated.