Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
cat << 'EOL' >>/etc/environment
no_proxy=localhost, 127.0.0.1, *.domain.com
http_proxy="http://proxyurl:80"
https_proxy="http://proxyurl:80"
ftp_proxy="ftp://proxyurl:80"
EOL
cat << 'EOL' >/etc/apt/apt.conf.d/95proxies
Acquire::http::proxy "http://proxyurl:80";
Acquire::ftp::proxy "ftp://proxyurl:80";
Acquire::https::proxy "http://proxyurl:80";
EOL
sudo reboot


The file:

/etc/environment

Is the correct place to specify system-wide environment variables that should be available to all processes.
If you want this for the specified command only, use (as root):

http_proxy=http://10.1.3.1:8080 apt-get update

Proxy Environment Variables:

http_proxy #Proxy server for HTTP Traffic
https_proxy #Proxy server for HTTPS traffic
ftp_proxy #Proxy server for FTP traffic
no_proxy #Patterns for IP addresses or domain names that shouldn’t use the proxy

No_Proxy needs to be configured

no_proxy=localhost, 127.0.0.1, *.my.lan

If you have an authenticating proxy, then the URLs will be different. Instead of:

http_proxy="http://myproxy.server.com:8080/"

You'll have:

http_proxy="http://user_name:password@myproxy.server.com:8080/"

Note that these are still URLs, so passwords (and possibly usernames) will have to be URL encoded.
For example, a username of muru and a password of )qv3TB3LBm7EkP} would look like:

http_proxy="http://muru:)qv3TB3LBm7EkP%7D@myproxy.server.com:8080/"

apt-get, aptitude, etc. will not obey the environment variables when used normally with sudo. So separately configure them; create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:

Acquire::http::proxy "http://myproxy.server.com:8080/";
Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
Acquire::https::proxy "https://myproxy.server.com:8080/";


https://askubuntu.com/questions/158557/setting-proxy-for-apt-from-terminal

https://askubuntu.com/questions/175172/how-do-i-configure-proxies-without-gui

  • No labels