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
- Mount the ISO file
# mkdir /media/cdrom
# mount /dev/sr0 /media/cdrom
- Create config file
# vi /etc/yum.repos.d/iso.repo
[dvd]
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
- 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
- Step # 1: Mount an ISO file
# rpm -i createrepo*
# mkdir /media/cdrom
# mount /dev/sr0 /media/cdrom
- Step # 2: Create a repository
# mkdir /tmp/repo
# cd /mnt/iso
# createrepo -o /tmp/repo .
- 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