转载:http://www.mvpbang.com/articles/2017/12/22/1513948827684.html
rhel7.x配置本地yum
环境: centos7.4 vmareworkstation11
01、加载iso 虚拟机–可移动设备–连接
02、挂载iso mount /dev/sr0 /mnt
03、移动yum源 mkdir /local_yum cp -a /mnt/{Packages,repodata,RPM-GPG-KEY-CentOS-7} /local_yum/
04、设置yum源
cd /etc/yum.repo.d/ mkdir bak
ls |grep -v bak |xargs -i mv {} bak/ #备份存在的yum
vim local.repo
[local_yum]
name=centos7.4
baseurl=file:///local_yum
enable=1
gpgcheck=1
gpgkey=file:///local_yum/RPM-GPG-KEY-CentOS-7
05、测试yum [[email protected] ~]# yum repolist
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status local_yum centos7.4 3,894 repolist: 3,894
centos7.4 http://mirrors.ustc.edu.cn/centos/7.4.1708/isos/x86_64/