真实原因是官方的yum源的url 废弃了,需要换成阿里云或者其他的yum源;
在centos7上ping http://mirrorlist.centos.org/ 是ping不通的,下面我们切换yum源;
1.备份原有yum源文件:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.在 /etc/yum.repos.d/ 新建一个CentOS-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 mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.ali