How Do You Set an Environment Variable for Every User Upon Rebooting a Linux Server?

Problem scenario
Without creating a hard or soft link of a file, how do you set an environment variable for every user after every reboot?


  1. Update the /etc/environment file so it has this stanza (but replace "JAVA_HOME" with the variable of your choice and replace /usr/bin/java with the path or value of the variable as you desire):


  1. Save the changes of the file. You are done. Log off as the user for the user you were logged in as to have the changes take effect.

If you want only one user to have the environment variable, see this posting.

Leave a comment

Your email address will not be published. Required fields are marked *