昨天,我正在使用PHP和MySQL在服务器上开发仪表板。我今天来完成所说的仪表板,并得到了以下输出:
git clone https://github.com/tbg/tcd
Cloning into 'tcd'...
fatal: unable to access 'https://github.com/tbg/tcd/': Could not resolve host: github.com
更深入地研究这个问题,我也使用apt-get
解决了以下问题:
apt-get update
Err:1 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Could not resolve 'ppa.launchpad.net'
Err:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Could not resolve 'security.ubuntu.com'
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Could not resolve 'ppa.launchpad.net'
Err:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Could not resolve 'us.archive.ubuntu.com'
Err:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
Could not resolve 'us.archive.ubuntu.com'
Err:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease
Could not resolve 'us.archive.ubuntu.com'
Err:7 https://download.docker.com/linux/ubuntu xenial InRelease
Could not resolve host: download.docker.com
Err:8 https://deb.nodesource.com/node_8.x xenial InRelease
Could not resolve host: deb.nodesource.com
Err:9 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Could not resolve 'repo.mongodb.org'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/InRelease Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Could not resolve 'security.ubuntu.com'
W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/InRelease Could not resolve host: download.docker.com
W: Failed to fetch http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/xenial/InRelease Could not resolve 'ppa.launchpad.net'
W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.2/InRelease Could not resolve 'repo.mongodb.org'
W: Failed to fetch https://deb.nodesource.com/node_8.x/dists/xenial/InRelease Could not resolve host: deb.nodesource.com
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease Could not resolve 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
尝试解析apt-get主机,我得到以下信息:
host -v us.archive.ubuntu.com
Trying "us.archive.ubuntu.com"
;; connection timed out; no servers could be reached
我认为这将是DNS问题,因此我检查了resolv.conf
文件,并收到以下输出:
cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
所以现在我迷路了,怎么回事,如何才能成功解决此问题?
编辑:
ifconfig
显示我的IP地址符合预期:
eno1 Link encap:Ethernet HWaddr d0:94:67:41:8b:b3
inet addr:10.1.1.78 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::d294:66ff:fe51:5bb3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13800 errors:0 dropped:1 overruns:0 frame:0
TX packets:2420 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4767680 (4.7 MB) TX bytes:559473 (559.4 KB)
Interrupt:17
答案 0 :(得分:0)
我在Ubuntu上也遇到了同样的问题:
运行:
systemctl enable systemd-resolved --now
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
nano /etc/systemd/resolved.conf
并添加相关的DNS,例如: DNS = 8.8.8.8
答案 1 :(得分:-1)
我可以通过以下方法完全解决此问题:
$ sudo dpkg-reconfigure resolvconf
$ sudo cat<<EOF > /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
$ /etc/init.d/networking restart
$ sudo ifdown <INTERFACE>
$ sudo ifup <INTERFACE>