apt-get via authentication proxy

Date: January 31st, 2010
Author: Stefan Batanov

This tutorial will demonstrate you something that most may need to use just for a few times in their Debian (Ubuntu) experience but will be very happy that such functionality was there at first place. Common Linux users, including me, are not so used to get updates through a proxy. Maybe used a proxy server once some time ago but I have totally forgotten that such things as proxies even existed in the Internet.

But just in case one day it happens that you find yourself in a corporate network and need to update a package as it currently doesn”t work as expected ( unfortunately we all have to admit that this is something common for Linux distributions, not only under Debian based systems) you will have to pass through a proxy.

For such cases after you finish reading this tutorial you will know how to configure apt-get for using proxy with basic authentication.

The apt configuration file is located in /etc directory

  1. /etc/apt.conf

You will need root privileges to edit apt.conf file. Open it with your favorite editor. In our example we use vi.

  1. [root@localhost ~]# vi /etc/apt.conf

The file generally should be empty if you use a default installation. If it is not please make sure you put the code bellow at the bottom of the file. Make sure you have the brackets as they are. Just a note that all lines starting with # (hash or pound symbol) are comments. So you can safely ignore them. In case the proxy doesn”t require username or password you can delete that part.

Put in your apt.conf the following:

  1. Acquire {
  2. Retries "0";
  3. HTTP {
  4. Proxy "http://user:password@proxy.foo.com:8080";
  5. };
  6. };

No restarts are needed. apt.conf will be checked on new apt-get command execution.

If you want to learn how to make wget work through a proxy click in the link.

VN:F [1.9.18_1163]
Rating: 1.6/10 (12 votes cast)
apt-get via authentication proxy, 1.6 out of 10 based on 12 ratings

Leave a Reply