What is the best place to setup system wide environment variables on Linux?
- by Sorin Sbarnea
I just want to setup a system wide environment variable, JAVA_HOME for all users, including root user.
Requirements:
accessible to normal users
accessible to root
always loaded, not only for bash (gnome-terminal does not start a bash by default)
to work on Ubuntu, Debian and optionally Red Hat
great if addition could be easily scripted
So far here is the no-list:
/etc/profile.d/java.sh - not executed if you start a new console from gnome-terminal
/etc/profile - same as above
~/.profile - current user only, also any solution assuming ~ would not be acceptable because home directory could be on NIS, and JAVA_HOME could be different.