Creating a Local YUM Repository with ISO

In Order to install or Update software in RHEL we need to connect to RHN (RedHat Network). By creating Local Repository we can install software from our own device. It saves things like bandwidth and time. All we need is an iso image (CD/DVD image).

Download the iso file from and place it in /iso directory

To Create a local repository; create a configuration file in /etc/yum.repos.d/ as *.repo

vim /etc/yum.repos.d/sans-local.repo
name=This is Local Repository

In this configuration file we have defined the repo url as a file and it is in /localrepo.
But in order to access that, we have to mount the iso file to that directory.
mkdir /localrepo
mount -o loop,ro /iso/rhel7.iso /localrepo

But this mount is not persistent, for persistent mount we have to edit the /etc/fstab file

vim /etc/fstab
/iso/rhel7.iso /localrepo iso9660 loop,ro 0 0
mount -a

then verify whether you have access to the local repository by giving a command
yum repolist
Now install package and play with the services

Leave a Reply