Last updated on November 22, 2020 by Dan Nanni
In RHEL-based Linux, login shell executes /etc/profile
script when a user logs in. This script customizes environment variables for all users system-wide. The script /etc/profile
also sources all the scripts placed in /etc/profile.d
directory. Therefore, in order to set system-wide environment variables in RHEL-based Linux, you can create a custom file with .sh extension in /etc/profile.d
as follows.
$ sudo vi /etc/profile.d/proxy.sh
export http_proxy=http://my.proxy.com:8000 export https_proxy=http://my.proxy.com:8000
If the proxy requires authentication, you can specify username and password as well.
export http_proxy=http://username:[email protected]:8000 export https_proxy=http://username:[email protected]:8000
Debian-based systems do not use /etc/profile.d
directory. Therefore, in order to set system-wide environment in Ubuntu or Debian, you can use /etc/environment
instead.
$ sudo vi /etc/environment
http_proxy=http://my.proxy.com:8000 https_proxy=http://my.proxy.com:8000
For proxy with authentication:
http_proxy=http://username:[email protected]:8000 https_proxy=http://username:[email protected]:8000
This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin (BTC Wallet: 1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g
).
Xmodulo © 2020 ‒ About ‒ Powered by DigitalOcean