I keep forgetting this, so I'm committing it to long-term memory. If you have a RedHat-based operating system (RH, CentOS etc) and you need to set certain environment variables so they're available to every user, one good place to do it is to drop a script ending in .sh in /etc/profile.d. Then export your desired environment variables there.
Here's an example from a CentOS machine I have:
# cd /etc/profile.d
# cat java.sh
export JAVA_HOME=/usr/java/default
Note that you can do whatever else you need in these scripts -- for example you can set up aliases etc. Every script in /etc/profile.d which ends in .sh gets sourced in /etc/profile.
1 comment:
For completeness though, you should also make a csh equivalent.
Post a Comment