错误 503:在代理后面使用 apt-get update 时服务不可用

7 apt proxy

我正在使用透明代理(其他框)。当我尝试执行“apt-get update”时,我收到以下警告(德语):

...

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/restricted/source/Sources.gz  503  Service Unavailable

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/universe/source/Sources.gz  503  Service Unavailable

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/multiverse/source/Sources.gz  503  Service Unavailable

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/main/binary-i386/Packages.gz  503  Service Unavailable

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/restricted/binary-i386/Packages.gz  503  Service Unavailable

W: Fehlschlag beim Holen von http://security.ubuntu.com/ubuntu/dists/maverick-security/universe/binary-i386/Packages.gz  503  Service Unavailable

E: Einige Indexdateien konnten nicht heruntergeladen werden, sie wurden ignoriert oder alte an ihrer Stelle benutzt.
Run Code Online (Sandbox Code Playgroud)

我改了~.bashrc:

http_proxy=http://192.168.120.199:8080
https_proxy=https://192.168.120:8080
export http_proxy
export https_proxy
Run Code Online (Sandbox Code Playgroud)

我在命令行上写道:

export http_proxy=http://proxyusername:proxypassword@proxyaddress:proxyport
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)

我编辑了/etc/apt/apt.conf:

Acquire::http::proxy "http://192.168.120.199:8080/";
Acquire::ftp::proxy "http://192.168.120.199:8080/";
Run Code Online (Sandbox Code Playgroud)

没有任何效果。

有谁知道如何通过透明代理使 apt-get 工作?

问候,

ubuntu2man

小智 5

某些代理实际上可能会根据user-agent字符串阻止流量。一个简单的

echo 'Acquire { http::User-Agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"; };' >> /etc/apt/apt.conf
Run Code Online (Sandbox Code Playgroud)

也可能是您解决此 503 问题的方法

  • 谢谢,这解决了我的问题。更详细和更新的解决方案在这里:https://dmfrsecurity.com/2018/12/10/changed-apts-user-agent-string/ (2认同)

LGB*_*LGB 2

我认为你不能用你的盒子做任何事情。503是来自代理的答案。如果您确定这是您设置的良好代理(192.168.120.199:8080),那么这不是您的问题,而是代理管理员的问题。如果是你,那么这是另一个问题,但你需要询问代理,它是什么类型的代理软件,等等。如果您非常确定自己设置得很好,就是这种情况。然而你写道: export http_proxy=http://proxyusername:proxypassword@proxyaddress:proxyport 现在我完全困惑了,你需要基于密码的身份验证吗?如果不是,为什么你在那里写用户名/密码?什么是“代理地址:代理端口,与您之前写的相同,192.168.120.199:8080?

如果我是你,我会删除你提到的文件中的所有这些修改,并且我会尝试仅设置 http_proxy 等参数。当它起作用时,如果您不想每次都手动设置,您就有时间进行修改。因此,恢复这些修改,然后仅输入以下内容:

http_proxy=http://192.168.120.199:8080

export http_proxy

apt-get update

如果您的代理确实是端口 8080 上的 192.168.120.199 并且它确实不需要身份验证,并且您的代理管理员授予对您的计算机的某种访问权限或不拒绝它,那么它将起作用。

另请注意,您所写的内容不是透明代理。透明代理是您甚至不需要设置的东西,因为传出流量会自动“抓取”并重定向以强制通过代理(这就是它“透明”的原因:您甚至不需要指定它)。您必须手动设置的内容:这不是透明代理。