转自https://www.cnblogs.com/cchilei/p/13884987.html
备份
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/
下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all 清除缓存,运行 yum makecache 生成新的缓存
yum clean all
yum makecache
安装EPEL(Extra Packages for Enterprise Linux )源
yum install -y epel-release
再次运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存
查看启用的yum源和所有的yum源
yum repolist enabled
yum repolist all
更新yum
yum -y update