A proxy is specified by setting the
all_proxy environment variables, either locally (e.g. in
~/.bashrc) or globally (e.g. in
/etc/bash.bashrc). These settings are honored by virtually all net-software packages (like apt-get, wget, curl etc.):
# HTTP proxy without authentification
# HTTP proxy with authentification
However, setting them this way does not help when running
sudo apt-get ... - and that is due to this line in
This line resets all environment variables when using
sudo, for security reasons. In order to keep the values of
http_proxy etc. in a
sudo invocation, you can specify exceptions to
# Exception specific to the command apt-get
Defaults!/usr/bin/apt-get env_keep="http_proxy https_proxy ftp_proxy"
# Exception specific to the user joe
Defaults:joe env_keep="http_proxy https_proxy ftp_proxy"
This way, you get
apt-get to honor the global setting for http_proxy, instead of duplicating the setting for
apt-get in some arcane apt-specific config file.