问题描述
当我需要在centOS7中安装docker时,会使用到yum命令,例如sudo yum install -y yum-utils。只要使用到yum命令时,就会报出如下错误:
[root@localhost ~]# yum install wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误”
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock。从这命令可以看出来,http://mirrorlist.centos.org/挂掉了,使用魔法去访问一下,发现服务一直报403错误,这是服务器的问题,可以理解为挂了。因为centOS在今年6.30后就不再维护了。
解决方案
既然国外的yum源不好用了,那就替换为国内的,我使用的是阿里的。
目标
更改 CentOS 7 系统的软件仓库源,从官方的 CentOS 镜像源切换到阿里云的 CentOS 7 镜像源,以获得更快的下载速度和更好的稳定性。
解决步骤
步骤一:前置准备
网络通畅
由于我使用的是vmware虚拟机,所以以此为基础进行展示。
要求:要能ping通百度。
[root@localhost ~]# ping baid