1.备份原本的yum源:
#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载阿里云的yum源:
CentOS6,CentOS7,CentOS8下对应的即可
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
期间提示:正在尝试其他镜像 没有关系,如果实在不行换网易的
下网易的:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
3.清除缓存
#yum clean all
4.重新设置缓存
#yum makecache
5.测试
#yum repolist