1.把iso镜像挂载到本地
mkdir /mnt/cdrom/
mount -t /dev/cdrom /mnt/cdrom/
df -h 查看一下是否挂载
2.启用python简易http服务
cd /mnt/ (#直接相当于把cdrom像http那样子给放到网页上面)
python -m SimpleHTTPServer 8000 & (#放到后台)
nohup python -m SimpleHTTPServer 8000 &(#在命令的开头加一个nohup,忽略所有的挂断信号,如果当前bash关闭,则当前进程会挂载到init进程下,成为其子进程,这样即使退出当前用户,其8000端口也可以使用。)
3.yum配置
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://192.168.255.10:8000/cdrom/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
清空yum缓存
yum clean all
yum makecache