今天在ubuntu虚拟机上执行apt-get update 发现无法更新 ,然后想到可能网络有问题,ping了一下外网的ip发现可以ping通,然后wget外网文件,发现如下错误。
root@mag-sit:/home/mag-sit/linux_amd64# wget http://cn.wordpress.org/wordpress-3.1-zh_CN.zip
--2016-05-06 10:00:28-- http://cn.wordpress.org/wordpress-3.1-zh_CN.zip
Resolving cn.wordpress.org (cn.wordpress.org)... failed: Name or service not known.
wget: unable to resolve host address ‘cn.wordpress.org’
网上进行搜索 发现是DNS的问题。
这说明你的系统并未正确配置DNS,无法解析某个域名,导致系统无法下载安装包,解决方法就是正确配置这个文件:
/etc/resolv.conf
这个文件就是用来配置系统DNS的,改成如下内容,保存即可:
nameserver 8.8.8.8
nameserver 8.8.4.4
然后直接再次验证,马上搞定!
root@mag-sit:/etc# wget http://cn.wordpress.org/wordpress-3.1-zh_CN.zip
--2016-05-06 10:02:16-- http://cn.wordpress.org/wordpress-3.1-zh_CN.zip
Resolving cn.wordpress.org (cn.wordpress.org)... 66.155.40.249, 66.155.40.250
Connecting to cn.wordpress.org (cn.wordpress.org)|66.155.40.249|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://cn.wordpress.org/wordpress-3.1-zh_CN.zip [following]
--2016-05-06 10:02:17-- https://cn.wordpress.org/wordpress-3.1-zh_CN.zip
Connecting to cn.wordpress.org (cn.wordpress.org)|66.155.40.249|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3448957 (3.3M) [application/zip]
Saving to: ‘wordpress-3.1-zh_CN.zip’
100%[====================================================================================================================================================================================================================================>] 3,448,957 1.21MB/s in 2.7s
2016-05-06 10:02:20 (1.21 MB/s) - ‘wordpress-3.1-zh_CN.zip’ saved [3448957/3448957]
本文地址: https://www.xiongge.club/biancheng/%e7%b3%bb%e7%bb%9f/518.html
转载请注明:熊哥club → ubuntu apt-get update 失败 Resolving xxx.x… failed:Name or service not known.
©熊哥club,本站推荐使用的主机:阿里云,CDN建议使用七牛云。
关注微信公众号『熊哥club』
免费提供IT技术指导交流
关注博主不迷路~