解决办法
删除yum.repos.d目录下所有文件
rm -f /etc/yum.repos.d/*
然后执行下边的命令,重新下载阿里的这个文件(需要外网)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
执行下边的命令,清理缓存
yum clean all
完成。
--------------------------------------------------------------------------------------------------------------------------------------------------
方法二,以上如果未解决问题可以尝试用另一种办法:
直接修改CenOS-Base.repo文件内容
修改/etc/yum.repos.d/CenOS-Base.repo文件内容如下:
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick