最近在用Centos 6.5 的时候出现了这种情况,
[root@bogon Desktop]# yum -y install docker
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.nwsuaf.edu.cn
* updates: mirrors.huaweicloud.com
http://mirrors.aliyun.com/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
Trying other mirror.
http://centos.ustc.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.neusoft.edu.cn'"
Trying other mirror.
遇到这种情况有两种做法:
1、没网,试着:ping www.baidu.com 如果显示没有连接的话,就说明没网,也就无法使用yum 命令。
2、ping通了的话,还是是用不了yum命令,说明是yum镜像没有了,那么就得下载一个来更新。
在安装完CentOS后一般需要修改yum源,才能够在安装更新rpm包时获得比较理想的速度。
国内比较快的有163源、sohu源。这里以163源为例子。
# cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo.backup
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
# mv CentOS6-Base-163.repo CentOS-Base.repo
# yum clean all
最后在使用yum 就可以了