首先清空原來的yum源

rm -rf /etc/yum.repos.d/*

CentOs 8

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

CentOs 7

curl -o /etc/yum.repos.d/Centos7-aliyun.repo https://mirrors.wlnmp.com/centos/Centos7-aliyun-x86_64.repo

創建yum源緩存

yum makecache