Master the Task of Setting Up a Local Yum Repository

In enterprise environments, having a local Yum server can streamline software package management and ensure consistent installations across systems. In this guide, we’ll walk through the process of setting up a Yum server in Red Hat Enterprise Linux (RHEL).

Step 1: Prepare the Environment

If you logged in with the root user then you don’t need to run commands with sudo.

Create a directory to mount the ISO:

$ sudo mkdir -p /mnt/disc/

Attach the ISO in the DVD drive

Mount DVD drive :

$ sudo mount /dev/sr1 /mnt/disc 

Verify the mounting point:

$ lsblk 
$ df -h

Step 2: Configure Local Yum Repository

Copy the media repository file to Yum repository directory:

$ sudo cp /mnt/disc/media.repo /etc/yum.repos.d/rhel.repo

Set permission for the repository file:

$ sudo chmod 644 /etc/yum.repos.d/rhel.repo

Edit the repository configuration file:

$ sudo vi /etc/yum.repos.d/rhel.repo

Press i to edit the file

Delete existing lines and paste this in it.

name=BaseOS Packages Red Hat Enterprise Linux

name=AppStream Package Red Hat Enterprise Linux

Press escape and type :wq for write and quite from the file

Clean Yum cache:

$ sudo yum clean all

Check enabled repositories:

$ sudo yum repolist enabled

Check all repositories:

$ sudo yum repolist all

List available packages:

$ sudo yum list all

Step 3: Permanent Mounting (Optional)

Edit the bashrc file for permanent mounting:

$ sudo vi /etc/bashrc

Add the mounting command:

mount /dev/sr1 /mnt/disc/


By following these steps, you can set up a Yum server in Red Hat Enterprise Linux, facilitating centralized package management and improving system administration efficiency. This local repository ensures availability of packages even without internet access, enhancing reliability and control over software installations.

Don’t miss out this amazing blog post on our website : Ubuntu in Windows WSL 2

Special thanks to my friend for their invaluable contributions to this blog post.

Did you find this post helpful? Leave a comment below if you have any questions!

Leave a Reply

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