How to Set Up a Local Yum/DNF Repository on CentOS 8

How to Set Up a Local Yum/DNF Repository on CentOS 8
In this article we are going to discuss about creating YUM server on CentOS 8. To configure YUM repository you are require CentOS 8 DVD or ISO file. Insert DVD into empty cd rom of system or you can copy CentOS DVD to OS where you want by creating directory like /cdrom or /yum.

[1]  Here I am just mounting DVD instead of coping full DVD into OS to save space on hard disk.

[2]  In this case CentOS8 installation DVD or ISO fie is mounted under /mnt folder, to copy media.repo file to /etc/yum.repos.d/ directory using cp command to create yum repository.

Here I created CentLocal.repo file for yum repository. Also set ‘’644” permission on file to read only by chmod command.  

 [3] Now add repository entries in “/etc/yum.repos.d/CentLocal.repo” file.

Now Let’s check what the above line means.

[1]    A name of Repository
[2]    BaseURL from which location the packages need to be downloaded.
[3]    Whether the Repo is enabled or not. 0 is Disabled, 1 is Enabled.
[4]    While installing a package whether it needs to check for GPG key.
[5]    Which key needs to be used to verify the packages.

Here 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 CentOS 8 resides under the root (/) of the ISO file.

[4] To clear yum extra files fire “yum clean all” which clears unnecessary files.

[5] Now its time to check yum by installing any one of the packages.

If you find package installed without throwing any error that show we have done with configuring a local yum repository.

Is this Helpful ? Yea/No

Reply in Coment Box Below.

Post a Comment