一、删除旧的yum环境
rm -rf /etc/yum.repos.d/*
二、下载新的Base源
CentOS 7
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS 8
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
三、下载新的EPEL源
CentOS 7
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
CentOS 8
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-archive-8.rep
四、清理缓存并生成新的缓存
yum clean all
yum makecache