连接
开启虚拟机,将CD设备进行连接,右击打开快捷菜单,选择“可移动设备”→“CD/DVD(IDE)” →“连接”命令
创建目录
[root@localhost ~]# mkdir /opt/centos
挂载
将CD设备挂载到/opt/centos(可自行创建)目录下
[root@localhost ~]# mount /dev/cdrom /opt/centos或者mount /dev/sr0 /opt/centos
[root@localhost ~]# ll /opt/centos
配置本地YUM源文件
先将/etc/yum.repos.d/下的文件先移走,然后创建local.repo文件
[root@localhost ~]#mv /etc/yum.repos.d/* /media/
[root@localhost ~]# vi /etc/yum.repos.d/local.repo
[centos7]
name=centos7
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[root@localhost ~]# cat /etc/yum.repos.d/local.repo