ubuntu apt-get proxy

转载:https://www.cnblogs.com/babykick/archive/2011/03/25/1996004.html

Ubuntu10.04 之后,发现apt-get的代理设置有改变了,在9.10以前使用“http_proxy”环境变量就可以令apt-get使用代理了

export http_proxy=http://127.0.0.1:8000
sudo apt-get update
然后在Ubuntu10.04下就无效了,看来apt-get已经被改成不使用这个环境变量了。

1、apt-get -o

apt-get有一个“-o”选项,直接给apt-get的设置变量

sudo apt-get -o Acquire::http::proxy="http://127.0.0.1:8000/" update

2、apt 配置文件

另一个是“/etc/apt/apt.conf”,这个就是apt的配置,内容如下

cat > ~/apt_proxy.conf << EOF
Acquire::http::proxy "http://127.0.0.1:8000/";
Acquire::ftp::proxy "ftp://127.0.0.1:8000/";
Acquire::https::proxy "https://127.0.0.1:8000/";
EOF

用“-c”选项来指定使用配置文件 “~/apt_proxy.conf”

sudo apt-get -c ~/apt_proxy.conf update

你可能感兴趣的:(ubuntu apt-get proxy)