Apt-get 更新连接失败,但 wget 正常

Apt-get 更新连接失败,但 wget 正常

我正在全新安装 bionic。该服务器位于中国上海,我尝试(但失败了)开始apt-get update工作。

措辞如下:

$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Connection failed [IP: 91.189.88.149 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic-security InRelease
  Connection failed [IP: 91.189.88.162 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Connection failed [IP: 91.189.88.149 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Connection failed [IP: 91.189.88.149 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Connection failed [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Connection failed [IP: 91.189.88.149 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

同时,wget也可以:

$ wget -SO /dev/null http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease
--2018-09-20 01:52:06--  http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.152, 91.189.88.149, 91.189.88.161, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.152|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Thu, 20 Sep 2018 01:52:07 GMT
  Server: Apache/2.4.18 (Ubuntu)
  Last-Modified: Thu, 26 Apr 2018 23:38:40 GMT
  ETag: "3b180-56ac8e31ec000"
  Accept-Ranges: bytes
  Content-Length: 242048
  Cache-Control: max-age=0, proxy-revalidate
  Expires: Thu, 20 Sep 2018 01:52:07 GMT
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
Length: 242048 (236K)
Saving to: ‘/dev/null’

/dev/null                                                   100%[========================================================================================================================================>] 236.38K   243KB/s    in 1.0s

2018-09-20 01:52:08 (243 KB/s) - ‘/dev/null’ saved [242048/242048]

/etc/apt/sources.list是新鲜出炉的,env的输出是典型的,并且我已经阅读了其他几篇提及的帖子/etc/apt/apt.conf,但实际上,这个文件在系统上甚至不可用。

我被难住了,有人知道吗?我在网上搜索了一下,聊天显示这是网络问题,但我该如何收集证据呢?

答案1

对于中国的服务器,请使用带有 https 的中国 repos。

https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

编辑你的/etc/apt/sources.list并放置那些镜像。

相关内容