Create a Local YUM Repository for RHEL 9.1 / CentOS 8

A local YUM (Yellowdog Updater Modified) repository on CentOS or RHEL (Red Hat Enterprise Linux) operating systems serves as a central location to store RPM (Red Hat Package Manager) packages and metadata files.

The purpose of a local YUM repository is to provide a way to manage and distribute software packages within a network without the need for external Internet connectivity. By setting up a local YUM repository, system administrators can ensure that all systems in their network have access to the same software packages and versions, and can also control when updates are applied.

Local YUM repositories can also provide faster access to software packages, as they can be downloaded and installed locally instead of over the Internet, which can be especially beneficial for networks with limited bandwidth.

In summary, the primary purpose of a local YUM repository on CentOS/RHEL is to simplify package management, ensure consistency across systems, and provide faster access to software packages.

Bellow you will find the steps to create repository for the desired OS

Step 1

mount /dev/cdrom /mnt
This helps you to mount the local media

Step 2

Become root

sudo su -
cd /
mkdir localrepo
cp -rv /media/* /localrepo/
You need to copy and extract the data

Step 3

rm -rf /etc/yum.repos.d/*
You remove the existing online repo

Step 4

vi /etc/yum.repos.d/local.repo
After, you create the repository

Now, very important, pay attention on what OS you use, because it may differ.

For Red Hat Enterprise Linux, it should look like this

name=rhel9
baseurl=file:///localrepo/
enabled=1
gpgcheck=0

And for CentOS

name=centos8
baseurl=file:///localrepo/
enabled=1
gpgcheck=0

Step 5

createrepo /localrepo/
After all the steps, an update of the database is needed

Step 6

yum clean all
Cache is cleaned

Step 7

yum repolist all
Verify repo

Step 8

yum install arcticguru
Test it

As a sum up, to create a Local YUM repository on CentOS/RHEL operating systems, you need to first mount the local media and copy the data to a new directory. Then remove the existing online repository and create a new repository file with appropriate configuration based on the operating system. Update the YUM database and clean the cache. Finally, verify the new repository and test it by installing a package. This allows you to have a local repository that can be used to install software packages on multiple systems without having to download them every time, saving bandwidth and time

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top