enz*_*tib 35
一个可能的解决方案是使用tsocks,一个可以通过socks 代理重定向网络流量的应用程序。安装tsocks包,修改/etc/tsocks.conf设置你的socks代理的地址和端口号,然后运行:
$ sudo -s
# tsocks apt-get update
# tsocks apt-get dist-upgrade
# exit
$
Run Code Online (Sandbox Code Playgroud)
或者
$ sudo -s
# . tsocks -on
# apt-get update
# apt-get dist-upgrade
# . tsocks -off # not really necessary, given the exit
# exit
$
Run Code Online (Sandbox Code Playgroud)
您可以考虑多种选择,以简化和自动化其使用。
不要忘记前导点,手册页对此有更多详细信息。
编辑:一种更短的使用方法:
$ sudo tsocks apt-get update
$ sudo tsocks apt-get dist-upgrade
Run Code Online (Sandbox Code Playgroud)
小智 35
Acquire::http::proxy "socks5h://server:port";
Run Code Online (Sandbox Code Playgroud)
这在 Ubuntu 18.04 上对我有用。正如手册页所说,apt支持socks5h,而不是socks5,这意味着具有DNS解析能力的socks5代理。
小智 10
使用下一个配置行对我有用:
Acquire::socks::proxy "socks5://server:port";
Run Code Online (Sandbox Code Playgroud)
为了保持apt.conf干净并避免 Linux 升级时出现问题,我创建了一个新文件 ( /etc/apt/apt.conf.d/12proxy) 并将配置文件添加到其中。
小智 6
我在 Ubuntu Xenial 的 apt.conf 手册中的Acquire::socks::proxy上找不到任何内容。您可以通过运行支持上游袜子代理的本地 http 代理来解决此问题,例如 Polipo。您需要按如下方式配置 Polipo:
proxyAddress = "::1"
proxyPort = 8118
socksParentProxy = "sockshost:socksport"
socksProxyType = socks5
Run Code Online (Sandbox Code Playgroud)
然后在 apt.conf 文件中设置 http 代理:
Acquire::http::proxy "http://127.0.0.1:8118/";
Acquire::https::proxy "https://127.0.0.1:8118/";
Run Code Online (Sandbox Code Playgroud)
小智 5
或者你可以在 /etc/apt/apt.conf 中添加如下内容:
Acquire::socks::proxy "socks://user:pass@host:port/";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56120 次 |
| 最近记录: |