How do I run apt-get when Im behind a proxy ?
Tuesday, 15 June 2010 13:56

In order configure your Ubuntu/Debian box to access HTTP, HTTPS and FTP via a Proxy you will need to assign some environment variables.

Assign Environmental Variables

Below shows you the different variables you need to declare :

export HTTP_PROXY=[PROXY IP]:[PORT]
export HTTPS_PROXY=[PROXY IP]:[PORT]
export FTP_PROXY=[PROXY IP]:[PORT]

Survive reboot

To survive a reboot you need to add these to /etc/bash.bashrc

echo export HTTP_PROXY=http://[PROXY IP]:[PORT] >> /etc/bash.bashrc
echo export HTTPS_PROXY=https://[PROXY IP]:[PORT] >> /etc/bash.bashrc
echo export FTP_PROXY=ftp://[PROXY IP]:[PORT] >> /etc/bash.bashrc

User Authentication

Below is an example if you need to add authentication credentials:

HTTP_PROXY=http://[USERNAME]:[PASSWORD]@[PROXY IP]:[PORT]



 
We have 59 guests online