Saturday 31 May 2014

How to create a YUM repository using an ISO image

In RedHat Linux like any other Linux distro, you can create a repository from an ISO image for patching and adding RPM’s on your system. The basic steps are mount the ISO image on a loop device, create the repo, then the last step is to configure your yum repository configuration files to point to the correct location.

Benefits of creating a local YUM repository:
  • You have a repository on your own machine
  • You don’t need an internet connection to install packages on you machine.
  • Your local repository is consistent and consistent for package installation or re-installation.
 Configuring YUM:
 
First of all you need to have an installation media, either a DVD or an iso image.
Mount these media on any directory on your machine.
 
Command for mounting iso image:

  • $mount -o loop -t iso9660 file.iso /mnt/iso
Now we have to copy the contents of inside the installation media to a directory of our desired location which we want to make the YUM repository.
Command to do this is:
  • $cp -rvf /mnt/iso/* /yum
 The asterisk sign (*) after the directory name suggest tha all the content is to be copied.  The above command shows that all the contents inside the /mnt/iso directory is to be copied under /yum directory.

once the copying is done we need to create a file with .repo extension.

 Now making a .repo File :

  •  $cd /etc/yum.repos.d
  •  $vi rhel.repo
[Repository]

name=yum-repository
baseurl=file:///yum
gpgcheck=0

Once you are done with your .repo file. You are good to go with your YUM utility. Just run a simple command to check whether it’s working or not.

  • $yum list

    If every thing goes fine you will see a list of packages in your YUM repository.If anything goes wrong then ping me, I’ll be more than happy to help you.
     

    Till then keep reading, keep sharing.


    

No comments:

Post a Comment