1)关闭selinux
vi /etc/selinux/config selinux=disabled reboot
2)创建挂载点,并挂载镜像
mkdir -p /mnt/iso mount -t iso9660 /home/CentOS-7-x86_64-Everything-1804.iso /mnt/iso
3)修改CentOS-Media.repo
cd /etc/yum.repos.d/ mkdir backup mv * ./backup vi CentOS-Local.repo
[Local] name=Localrepo baseurl=file:///mnt/iso gpgcheck=0 enabled=1
4)清除并重建cache
yum clean all
yum makecache
yum repolist