How To Proxy The Apt-Get Package Manager

How To Proxy The Apt-Get Package Manager

Get Social!

If you’re using Debian, Ubuntu, or any similar distribution which uses apt-get as it’s package manager and you’re behind a http proxy then you’re going to need to tell apt-get what your proxy settings are.

The way you tell apt-get what your proxy settings are is simple; set an environment variable and apt-get will pick it up and do the rest.

Set an environment variable called http_proxy and specify your http proxy server protocol (http or https), ip address and port. apt-get will then direct all of it’s fetch operations through the http proxy using the specified details. Use the following syntax to export the http_proxy variable and substitute IP and PORT for your proxy details.

export http_proxy=http://IP:PORT

For example, if your proxy uses the ip 10.10.10.10 and port 8080 then you’d write the following:

export http_proxy=http://10.10.10.10:8080

If your proxy requires user authentication then use the below syntax, substituting USER and PASSWORD for your proxy authentication details.

export http_proxy=http://USER:[email protected]:8080

You can also add this to your .bash_profile so that the variable is set each time you log in. Just remember to update your password if it ever changes!

vi ~/.bash_profile

Visit our advertisers

Quick Poll

How many Proxmox servers do you work with?

Visit our advertisers