备份当前的yum源配置文件

sudo cp -a /etc/yum.repos.d /etc/yum.repos.d.backup

清理原有的yum源配置文件

sudo rm -f /etc/yum.repos.d/*.repo

下载阿里云CentOS 8的源配置文件

sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

清除yum缓存并生成新的缓存

sudo yum clean all
sudo yum makecache