预备工作:
1、安装好Linux操作系统
2、将安装镜像iso文件上传至虚拟机任意目录
正式步骤:
[root@node-1 ~]# mkdir /dev/local_CentOS
[root@node-1 ~]# mount -o loop /home/CentOS-6.10-x86_64-bin-DVD1.iso /dev/local_CentOS/
[root@node-1 ~]# mkdir /mnt/local_yum
[root@node-1 ~]# cp -r /dev/local_CentOS/* /mnt/local_yum
[root@node-1 ~]# cd /etc/yum.repos.d/
[root@node-1 yum.repos.d]# rename .repo .repo.bak *.repo
[root@node-1 yum.repos.d]# cp CentOS-Base.repo.bak CentOS_local.repo
[root@node-1 yum.repos.d]# cp CentOS-Media.repo.bak CentOS-local.repo
[root@node-1 yum.repos.d]# vim CentOS-local.repo
[root@node-1 yum.repos.d]# yum clean all
[root@node-1 yum.repos.d]# yum repolist
[root@node-1 yum.repos.d]# umount /dev/local_CentOS
[root@node-1 yum.repos.d]# rm /dev/local_CentOS/ -rf