1、 创建文件,挂载 rhel7-repo-iso
[root@rhel7 ~]# mkdir /media/rhel7-repo-iso [root@rhel7 ~]# mount /dev/cdrom /media/rhel7-repo-iso/ mount: /dev/sr0 is write-protected, mounting read-only
2、yum文件引入挂载点
[root@rhel7 ~]# vi /etc/yum.repos.d/RHEL_7_Disc.repo [root@rhel7 ~]# cat /etc/yum.repos.d/RHEL_7_Disc.repo [RHEL_7_Disc] name=RHEL_7_x86_64_Disc baseurl="file:///media/rhel7-repo-iso/" gpgcheck=0
3、列出yum
# yum repolist Loaded plugins: product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. RHEL_7_Disc | 4.1 kB 00:00:00 (1/2): RHEL_7_Disc/group_gz | 134 kB 00:00:00 (2/2): RHEL_7_Disc/primary_db | 3.4 MB 00:00:00 repo id repo name status RHEL_7_Disc RHEL_7_x86_64_Disc 4,305 repolist: 4,305