进入yum源配置文件所在路径
cd /etc/yum.repos.d
备份配置文件
mv CentOS-Base.repo CentOS-Base.repo.backup
获取源配置文件
wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
wget https://mirrors.aliyun.com/repo/epel-7.repo
清理缓存、重新生成
yum clean all && yum makecache
参考文档:
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.53322f709PDi7s