创建挂载路径
mkdir -p /media/CentOS7
挂载ISO文件到新建路径下
mount -t iso9660 -o loop CentOS-7.7-x86_64-DVD-1908.iso /media/CentOS7
/root/CentOS-7.7-x86_64-DVD-1908.iso /media/CentOS7 iso9660 defaults,ro,loop 0 0
备份原repo文件
cd /etc/yum.repo.d
mkdir bak
mv ./* bak
mv ./bak/CentOS-Media.repo ./
vi CentOS-Media.repo
新建文件并修改成以下配置
[root@12345-ivr yum.repos.d]# cat CentOS-Media.repo
[centos7-media]
name=centos7
baseurl=file:///media/CentOS7
enabled=1
gpgcheck=0
gpgkey=file:///media/CentOS7/RPM-GPG-KEY-CentOS-7