Couldn't resolve host 'mirrors.cloud.aliyuncs.com'
微wx笑 2019-10-19【操作系统】 12 0关键字: CentOS
执行 yum update - security 的时候,输出 "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"完整提示信息:# yum update - securityLoaded plugins: fastest
执行 yum update - security 的时候,输出 "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
完整提示信息:
# yum update - security Loaded plugins: fastestmirror, refresh-packagekit Setting up Update Process Loading mirror speeds from cached hostfile * remi-safe: mirror.innosol.asia http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'" Trying other mirror. http://mirrors.cloud.aliyuncs.com/epel/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'" Trying other mirror. No package - available. No Match for argument: security No package security available. No Packages marked for Update
有文章提出替换 http://mirrors.cloud.aliyuncs.com/centos/ 为 http://mirrors.aliyun.com/centos/,
但是替换后执行命令提示:
# yum update - security Loaded plugins: fastestmirror, refresh-packagekit Setting up Update Process Loading mirror speeds from cached hostfile * remi-safe: mirror.innosol.asia http://mirrors.aliyun.com/centos6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. http://mirrors.aliyun.com/centos6/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.aliyun.com/centos6/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. No package - available. No Match for argument: security No package security available. No Packages marked for Update
错误变成了404,感觉不对,还好替换之前做了备份,又替换回来。
然后看到有文章提到可能是DNS的原因,于是添加DNS
1.添加dns记录
cd /etc/sysconfig/network-scripts/
找到类似ifcfg-eth0的文件vi打开;注意:你的网卡不一定是这个名字
添加DNS,在文件内容后面添加就可以了,可以添加多个
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes DNS1=8.8.8.8 DNS2=4.4.4.4 DNS3=114.114.114.114
2.重启网络 service network restart
OK,问题到这就解决了。
其实还有一种修改DNS的方法,直接修改/etc/resolv.conf 文件
vi /etc/resolv.conf
我的文件内容如下:
# Generated by NetworkManager nameserver 100.100.2.136 nameserver 100.100.2.138 nameserver 8.8.8.8 # NOTE: the libc resolver may not support more than 3 nameservers. # The nameservers listed below may not be recognized. nameserver 4.4.4.4 nameserver 114.114.114.114
参考:
yum报错 Couldn't resolve host 'mirrors.cloud.aliyuncs.com
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/system/2019-10-19/263.html