我在使用Vagrant的yum遇到了问题

在Windows环境下安装和运行Vagrant时遇到了一个问题,无法使用yum命令。

从安装到登录CentOS之前,我参考了这篇文章在Windows上使用VirtualBox+Vagrant+CentOS构建虚拟环境。

我安装了Yum之后遇到了这样的错误。。

[root@localhost ~]# yum -y install httpd
Geladene Plugins: fastestmirror
base                                                                         | 3.6 kB  00:00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#52 - "Empty reply from server"

看起来yum的存储库中的URL已经无效了。

据说 /etc/yum.repos.d/CentOS-Base.repo 文件中的 mirrorlist 有问题。
因此,我把 mirrorlist 注释掉,
取消了 baseurl 的注释,然后就可以执行 yum 了。

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7