Set System-Wide Proxy settings on Debian from CLI
For this we will create a file inside /etc/profile.d directory and set Proxy settings that will work for all users on a Debian Linux system.
sudo vim /etc/profile.d/proxy.sh
Populate your proxy values.
# set proxy config via profie.d - should apply for all users
# http/https/ftp/no_proxy
export http_proxy="
http://10.10.1.20:8080/"
export https_proxy="
http://10.10.1.20:8080/"
export ftp_proxy="
http://10.10.1.20:8080/"
export no_proxy="127.0.0.1,localhost"
# For curl
export HTTP_PROXY="
http://10.10.1.20:8080/"
export HTTPS_PROXY="
http://10.10.1.20:8080/"
export FTP_PROXY="
http://10.10.1.20:8080/"
export NO_PROXY="127.0.0.1,localhost"
Add any additional IP address to be excluded to the NO_PROXY & no_proxy environment variables. When done add execution bit to the script created.
sudo chmod +x /etc/profile.d/proxy.sh
Any user in the system that needs to use these settings have to log out and back in:
logout
Alternatively, source the file for runtime use:
source /etc/profile.d/proxy.sh
Confirm proxy has been loaded in your environment.
$ env | grep -i proxy