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 redhat.com 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
[sansbound]
name=This is Local Repository
baseurl=file:///localrepo
gpgcheck=0
enabled=1

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