Linux/Ubuntu: Server: Configuring proxies

PHOTO EMBED

Mon Aug 29 2022 14:24:23 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

$ sudo nano /etc/environment

#
# (Append these lines at the end of file:)

http_proxy="http://myproxy.server.com:8080/"
https_proxy="http://myproxy.server.com:8080/"
ftp_proxy="http://myproxy.server.com:8080/"
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY="http://myproxy.server.com:8080/"
HTTPS_PROXY="http://myproxy.server.com:8080/"
FTP_PROXY="http://myproxy.server.com:8080/"
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"

#
# (save and... )

$ source /etc/environment

# To unset proxies:

# sudo nano /etc/environment
#
# (Remove proxies lines (see above))
#
# (save and them...) 

unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset FTP_PROXY
unset NO_PROXY

# (that's all)


# ========== using proxies for apt (it does not obey proxy configuration):

# (we create a new file at /etc/apt/apt.conf.d/)
#

$ sudo nano /etc/apt/apt.conf.d/95proxies

# (now append this lines...)

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

# (save and run "sudo apt update" for trying...)
#
content_copyCOPY