How To Set Local YUM/DNF Repository On RHEL 8?

In this article, I will explain how a local repository is set up on RHEL 8. If you want to install a package in RHEL 8, it will throw an error telling you the dependencies and the repo files error. So to resolve this error, we should install YUM / DNF repository locally or use RHEL’s subscription management. Friends, likewise, in other distros of RHEL we had to set repo files manually, as expected here we would have to do the same. So here I will tell you the set up of local YUM / DNF repo using DVD. So let’s start without wasting time –

So friends to create YUM/DNF repo you should have a DVD/ISO image of rhel8. It is because it contains the required packages and dependencies in it. So with the help of this DVD image, first we will mount it in a directory and then we will create a repo file for yum and DNF.

Friends in RHEL 8  DVD/ISO image, we have 2 main directories that contain administrative packages and OS related packages. So first one is BaseOS and 2nd one is AppStream.

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.

Steps To Create YUM/DNF Repository

  1. Mount DVD image or ISO File 

[Linux-Kings@Server ~]# mount /dev/sr0 /mnt

After mounting DVD or ISo whatever you have, it’s time to create the repository for YUM/DNF. So let’s create a file named yum.repo or you can give it according to your wish. But the file extension must be .repo otherwise it will not work as a repository file so keep in mind before creating a repo file.

 [Linux-Kings@Server ~]# vim /etc/yum.repos.d/yum.repo

2. After typing this command you will get into the vim editor where you have to write the below content to set up a local repository for the RHEL 8.




If you are a beginner then try to keep as same as what I have mentioned here but if you have some knowledge about RHEL or you are some advanced with the RHEL then you can manipulate this entry.

3. Now check that you have successfully configured the local repo. So to check this type below command.

[Linux-Kings@Server ~]# yum repolist all


[Linux-Kings@Server ~]# dnf repolist

After seeing the result you get confirmed that it is successfully configured or not. If still, it shows any error to you please let me know in the comment box so that I can help you.  And if it shows the repo files as shown in the image then you have created the repository successfully. Now you can install any packages that you want to install with the below command.

[Linux-Kings@Server ~]# yum install package_name


[Linux-Kings@Server ~]# dnf install package_name 

So Friends this all about how to create YUM/DNF repository on RHel. Friends, if you have doubts or any queries about this post then don’t hesitate to contact me. If you like my posts please share them with your friends

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s