- 挂载iso镜像. 假设镜像放置在/usr/local/src/CentOS-7-x86_64-DVD-2009.iso
mkdir /media/CentOS7
mount -t iso9660 -o loop /usr/local/src/CentOS-7-x86_64-DVD-2009.iso /media/CentOS7
- 备份原始yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bk
- 添加本地源
vi /etc/yum.repos.d/CentOS7-Local.repo
[CentOS7-Local]
name=CentOS7
baseurl=file:///media/CentOS7
enable=1
gpgcheck=0