1.备份现有源
mv /etc/yum.repos.d /etc/yum.repos.d.backup
2.设置新的yum目录
mkdir /etc/yum.repos.d
更新地址
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
yum clean all
yum makecache
最后更新包
yum update -y