先將ISO文件掛載起來:bash
[root@racdb1 ~]# mount -o loop /opt/soft/rhel-server-6.8-x86_64-dvd.iso /mnt/iso [root@racdb1 ~]# df| grep iso /opt/soft/rhel-server-6.8-x86_64-dvd.iso 3787224 3787224 0 100% /mnt/iso [root@racdb1 ~]# mount| grep iso /opt/soft/rhel-server-6.8-x86_64-dvd.iso on /mnt/iso type iso9660 (rw,loop=/dev/loop0)
生成文件/etc/yum.repos.d/iso.repo,同目錄的其它文件能夠移動位置備份起來。oop
root@racdb1 yum.repos.d]# pwd /etc/yum.repos.d [root@racdb1 yum.repos.d]# [root@racdb1 yum.repos.d]# cat iso.repo [iso] name=iso baseurl=file:///mnt/iso enabled=1 gpgcheck=0 [root@racdb1 yum.repos.d]#
而後初始化yum環境:url
[root@racdb1 yum.repos.d]# yum clean all Loaded plugins: product-id, search-disabled-repos, security, subscription- : manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning repos: iso Cleaning up Everything [root@racdb1 yum.repos.d]# yum makecache Loaded plugins: product-id, search-disabled-repos, security, subscription- : manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. iso | 4.1 kB 00:00 ... iso/group_gz | 216 kB 00:00 ... iso/filelists_db | 3.4 MB 00:00 ... iso/primary_db | 3.1 MB 00:00 ... iso/other_db | 1.3 MB 00:00 ... Metadata Cache Created
而後就可使用yum install ... 安裝包了。code