Skip to main content

Ubuntu 20 Web Proxy Configuration

Web Proxy Config for all Users

To configure a web proxy for Ubuntu for every user edit the /etc/environment file:

sudo nano /etc/environment

Add the following lines to the end of the file and adjust accordingly:

export HTTP_PROXY="[username]:[password]@[proxy-web-or-IP-address]:[port-number]"
export HTTPS_PROXY="[username]:[password]@[proxy-web-or-IP-address]:[port-number]"
export FTP_PROXY="[username]:[password]@[proxy-web-or-IP-address]:[port-number]"
export NO_PROXY="localhost,127.0.0.1,::1"

As an example, this line for a web proxy with no authentication at 192.168.1.3 on port 3128 would be:

export HTTP_PROXY="192.168.1.3:3128"
export HTTPS_PROXY="192.168.1.3:3128"
export FTP_PROXY="192.168.1.3:3128"
export NO_PROXY="localhost,127.0.0.1,::1"

Web Proxy Config for APT (Updates)

Edit the /etc/apt/apt.conf file:

sudo nano /etc/apt/apt.conf

Add the following lines to the end of the file and adjust accordingly:

Acquire::http::Proxy "http://[username]:[password]@[proxy-web-or-IP-address]:[port-number]";
Acquire::https::Proxy "http://[username]:[password]@[proxy-web-or-IP-address]:[port-number]";

Using the same example as above this would be:

Acquire::http::Proxy "http://192.168.1.3:3128";
Acquire::https::Proxy "http://192.168.1.3:3128";