Linux Articles Linux Training

How to Configure a Local Yum Repository Using an ISO Image

How to Configure a Local Yum Repository Using an ISO Image

Describe:

In this will be detailed the steps to mount the ISO image and configure the local YUM repositories to install the required package after that, and the steps to unmount the ISO.

Steps to Mount the ISO Image:
First, download the ISO image to the Linux machine.
– To mount the ISO image, first create the mount point folder.
– Continue the process while logged in to the system as a root user, or use ‘sudo’ to execute the commands.
Follow the commands to create a folder,

commands: $mkdir /mnt/image or $sudo mkdir /mnt/image

  • Once mount point create use ‘mount’ command to mount the ISO image “rhel-server-7.1-x86_64-dvd.iso”
$mount -t iso9660 -o loop rhel-server-7.1-x86_64-dvd.iso /mnt/image/
or
$mount -o loop rhel-server-7.1-x86_64-dvd.iso /mnt/image/

Where the options mention:
-t – Allows to use the following file system
iso9660 – Default file system type for ISO/ DVD
-o – allows the options to multiple arguments
loop – loop is the device to use mount ISO/DVD and makes it as block device.

– Mount will be write-protected, and once mount is done, you can list the packages inside the mount point.
– CD “/mnt/image/packages” will consist of all the listed packages.

Steps to Configure Yum Local:

  • Must now configure the local repositories for yum update to work.
  • Navigate to the yum repos directory.
    cd “/etc/yum.repos.d/”
  • Create a file for the local repository as follows:
$vim local-repos.repo
             Now enter the following lines,
              [local-repos-repo] 
              name=redhat local repository 
              baseurl=file:///mnt/image
              enabled=1 
              gpgcheck=0
  • Save the file and exit.
  • Move the other repo file under /etc/yum.repos.d/ to another location. Only newly configured repos exist in the directory.
  • Once moved, use “yum clean all,” which will clean all cache in the repository.
  • Now use the “yum repolist” command to see the local repository configuration status.
  • You can install any package now using the “yum install” command,
               – example: $yum install eksh

Steps to Unmount ISO Image:

  • unmount is quite simple, and make sure to run the command as root user,
$umount /mnt/image or $sudo umount /mnt/image
$ df -h (To check unmount status)

Tags:Linux,ubuntu,mount, yum repos, local repos,mytecharticle,configure repos,unmount, iso configure

About the author

admin

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.