1. Create directory for mounting
$ mkdir -p /cdrom/iso
2. Mount the iso at the loopback device
$ mount -o loop </path/to/iso-file> /cdrom/iso
3. Create a repository using the the mounted directory
$ cd /cdrom
$ createrepo .
$ yum clean all
4. Create a yum repo file
$ cat /etc/yum.repos.d/file.repo
[RHEL]
baseurl=file:///cdrom/
enabled=1
gpgcheck=0
Troubleshoot:
* If createrepo package is not installed, find it into the mounted directory & and install first
$ find /cdrom/iso/ -name "*createrepo*"
$ rpm -ivh /cdrom/iso/Server/createrepo*.rpm
Mounting permanently:
To mount /cdrom/iso permanently, a entry need to made in /etc/fstab
/iso-name /cdrom/iso iso9660 ro,loop 0 0
Mounting permanently:
To mount /cdrom/iso permanently, a entry need to made in /etc/fstab