1、查看yum源信息
yum repolist
2、切换到yum源配置文件目录
cd /etc/yum.repos.d
3、备份旧的yum源配置文件
sudo mv CentOS-Base.repo CentOS-Base.repo.bak
4、下载阿里的yum源文件
sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/Centos-7.repo
5、清理缓存
yum clean all
6、重新生成缓存
yum makecache
7、再次查看yum源
yum repolist

替换成功!