Creating a Local Yum Repository Using an ISO Image


  1. Copy an ISO image to the Yum server
    # cp /CentOS/7.4.iso /ISOs/.
  2. Create a mount point for the new ISO
    # mkdir -p /mnt/CentOS/7.4 # mount -o loop,ro /ISOs/7.4.iso /mnt/CentOS/7.4
  3. Create an entry in /etc/fstab
    /ISOs/7.4.iso /mnt/CentOS/7.4 iso9660 loop,ro 0 0
  4. Edit /etc/yum.repos.d directory to disable entries by setting enabled=0.
  5. Create a new repository file (/etc/yum.repos.d/CentOS.7.4.repo).
    [CentOS74]
    name=CentOS_7.4
    baseurl=file:///mnt/CentOS/7.4
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
    gpgcheck=1 
    enabled=1
  6. Clean yum cache.
    # yum clean all
  7. Test the repository.
    # yum repolist