禁用 IPv6 解析
Convince apt-get *not* to use IPv6 method – Unix & Linux Stack Exchange
echo ‘Acquire::ForceIPv4 “true”;’ | tee /etc/apt/apt.conf.d/99-force-ipv4
或者,使用 apt-get -o Acquire::ForceIPv4=true 选项
代理服务,加速下载
syntax for SOCKS proxy in apt.conf How to use “apt-get” via “Http-proxy” like this? man 5 apt.conf man apt-transport-http man apt-transport-https
有时需要使用 SOCKS/HTTP(S) 代理进行软件包下载,以提高网络下载速度。
操作系统:Kali GNU/Linux Rolling / apt 1.8.4 (amd64)
方法一、创建 /etc/apt/apt.conf.d/99socks.conf 配置:
cat > /etc/apt/apt.conf.d/99socks.conf <<EOF
Acquire::http::proxy “socks5h://127.0.0.1:1080”;
EOF
方法二、命令行指定(推荐)
http_proxy=’http://127.0.0.1:8123′ apt-get update
注意事项,应该使用 http_proxy,而不是 HTTP_PROXY 变量。
附加说明
Differentiate socks5h from socks5 and socks4a from socks4 when handling proxy string #1035 In a proxy string, socks5h:// and socks4a:// mean that the hostname is resolved by the SOCKS server. socks5:// and socks4:// mean that the hostname is resolved locally. socks4a:// means to use SOCKS4a, which is an extension of SOCKS4.[……]