1. 备份原来的yum源
$sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.设置aliyun的yum源
$sudo wget -O /etc/yum.repos.d/CentOS-Base.repo
3.添加EPEL源
$sudo wget -P /etc/yum.repos.d/
4.清理缓存,生成新缓存,执行yum更新
$sudo yum clean all
$sudo yum makecache
$sudo yum update
感谢阿里为国内开发者做的贡献
摘自 https://blog.csdn.net/zytbft/article/details/81166345