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
This helps you to mount the local mediamount /dev/cdrom /mnt
Step 2
Become root
You need to copy and extract the datasudo su - cd / mkdir localrepo cp -rv /media/* /localrepo/
Step 3
You remove the existing online reporm -rf /etc/yum.repos.d/*
Step 4
After, you create the repositoryvi /etc/yum.repos.d/local.repo
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
After all the steps, an update of the database is neededcreaterepo /localrepo/
Step 6
Cache is cleanedyum clean all
Step 7
Verify repoyum repolist all
Step 8
Test ityum install arcticguru
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