High Availbility

OS & Virtualization

Tuesday, June 04, 2013

Howto Setup Yum repositories ISO CDROM

Q : How do you use yum to update / install packages from an ISO of CentOS / FC / RHEL CD?

Solution 1 : Use your DVD directly without creating any repo
  1. Mount the ISO file
    # mkdir /media/cdrom
    # mount /dev/sr0 /media/cdrom
  2. Create config file
    # vi /etc/yum.repos.d/iso.repo

    [dvd]
    baseurl=file:///media/cdrom
    enabled=1
    gpgcheck=0
  3. Run the command
    # yum install --enablerepo=dvd packagename
Solution 2 : Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images

  1. Step # 1: Mount an ISO file
    # rpm -i createrepo*
    # mkdir /media/cdrom
    # mount /dev/sr0 /media/cdrom
  2. Step # 2: Create a repository
    # mkdir /tmp/repo
    # cd /mnt/iso
    # createrepo -o /tmp/repo .
  3. Step # 3: Create config file
    # vi /etc/yum.repos.d/iso.repo

    Append following text:
    [ISO Repository]
    baseurl=file:///media/cdrom
    enabled=1
Now use yum command to install packages from ISO images:
# yum install package-name

No comments: