In this article will discuss about to how to create a local repository on RHEL8 Red Hat Enterprise Linux operating system 8 (or) Community ENTerprise Operating System 8 Machines.
In fact, Software repositories also called repositories are locations where Redhat Linux distribution packages are stored and maintained for users to download and install.
New Repository in RHEL 8
AppStream and BaseOS were introduced in RHEL 8 and CENTOS 8, respectively.
BaseOS : A base OS repository contains all the underlying OS packages, while an application stream repository contains all the application-related packages, developer tools, and databases.
Application Stream (AppStream): Multiple versions of the same application and database can be stored in an application stream repository.
More detail explanation AppStream and BaseOS
Below is the Procedure to Create Local Yum/DNF Repository on RHEL8/CENTSOS 8 Machines.
Create Local Repository on RHEL8 Machine:
Red Hat Enterprise Linux operating system doesn’t contain any local repositories by default.
When you create a local repository, you can install software packages and updates without requiring an internet connection.
Step1: Check Repositories
Below is newly installed RHEL8 machine. By default, RHEL doesn’t contain any local repositories.

Step2: Testing Local Repository
For testing purpose let’s try to install telnet package.

Step3: Mounting RHEL 8 Installation ISO File
- Mount RHEL8.4 ISO in virtual machine.
- After mounting enter into OS and execute partprobe command. It helps to inform the OS kernel of partition table changes.
- Mount DVD drive (/dev/sr0) to /media like below mentioned screenshot.

Step4: Create Source Directory
To copy the content in /media, we have to create an empty directory called /myiso

Step5: Copy all files and directories.
Copy the content from /media to /myiso

Step6: Verify the content.
Check the data in /myiso directory.

AppStream and BaseOS are main repositories in RHEL8 which contains application features and base core functionality of operating system.

Step7: Creating a Yum Repository file.
To use above files and directories, create an empty repository with extension. repo example: myfile.repo at /etc/yum.repos.d

Step8: Configure AppStream and Baseos in myfile.repo
- Configure myfile.repo with AppStream and Baseos location.
- [BaseOS] It is a name that indicates the repo ID.
- name is the name given for the repository.
- baseurl is the location of the ISO dump we have made in step6.
- 1 for enable the repository 0 means disable.
- gpgcheck = GNU privacy guard. gpgcheck used for signature verification from its central database.
- gpgkey= it is public key can be used to verify RPM packages built and signed by Red Hat
- It is located in every RHEL8 machine at /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release.
- metadata_expire by default its expiry time in 90 minutes and -1 indicate never expires.

Step9: Listing the Created Yum Repository
Once the repositories have been created, verify their inclusion in the enabled repository list. check myfile.repo status by using yum repolist (or) yum repolist all.

Step10: Install Packages from Local YUM repository.
To check myfile.repo functionality, install a package example: telnet.

Conclusion:
The RHEL 8 local yum repository was created using the ISO file and should help anyone looking for a way to install a few packages without having a valid subscription for RHEL.
Thanks for visiting here, leave a comment if you have any queries about Create Local Repository on RHEL8.
You can also connect a RHEL machine to subscription.