apt-get proxy configuration

Debian GNU/Linux
Q. How can I configure apt-get to update my packages if I'm behind a proxy?

R. you must edit the /etc/apt/apt.conf file and add the following line.

Acquire::http::Proxy "http://user:password@proxy.myproxyserver.com:port"

If the proxy does not require authentication you can ignored the user and password, if the proxy is listening on port 3128, port configuration also can be omitted.

Acquire::http::Proxy "http://proxy.myproxyserver.com";

If the proxy only accepts user known agents then add the following line to the /etc/apt/apt.conf

Acquire::http::User-Agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (FM Scene 4.6.1)";

You can specify both options from the command line, for example:

$ sudo apt-get -o Acquire::http::User-Agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (FM Scene 4.6.1)' -o Acquire::http::Proxy "http://user:password@proxy.myproxyserver.com:port";  update

Further reading

– man apt-get
– man apt.conf




Leave a Comment

Your email address will not be published. Required fields are marked *