This is a more general answer along with apt config.
As there are a lot of places to configure proxy settings, it might get confusing at beginning. Let me summarize some things and suggest some good practices.
For console programs
Ex: wget
, git
and almost every console application which connects to internet.
If you want to configure proxy every time you run your commands then set the environment variables using following commands.
export http_proxy="http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/"
export ftp_proxy="http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/"
Else if you want to use the same settings every time for all users, then:
Configure in bashrc
$ nano /etc/bash.bashrc
export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
To apply user-wide use ~/.bashrc
.
Configure in /etc/environment
$ nano /etc/environment
https_proxy="http://myproxy.server.com:8080/"
ftp_proxy="http://myproxy.server.com:8080/" ...
Configure using GUI
Open the network settings and set your system-wide network proxy.
Network → Network proxy → Configure → Apply system-wide.
But this might not be useful if you have authentication for the proxy.
For apt
You need to do some extra work for apt, as apt doesn't care about the proxy environment variables.
$ nano /etc/apt/apt.conf
Acquire::http::Proxy "http://USERNAME:PASSWORD@SERVER:PORT";
Acquire::https::Proxy "https://USERNAME:PASSWORD@SERVER:PORT";
For everything out of this scope, there will likely be an option to configure proxy settings in the application itself.