vim localyum.sh
#!/bin/bash mount /dev/sr0 /mnt cd /etc/yum.repos.d mkdir bak mv *.repo bak echo " [local] name=local baseurl=file:///mnt gpgcheck=0 ">local.repo yum clean all && yum makecache
yum list all
注意:运行脚本前确保VM已经连接镜像