Set Environment Variables for all Users on the Node

You can set these environment variables persistently for all users by adding them to the /etc/environment file as root or using sudo.
  1. As root or using sudo, set JAVA_HOME and HADOOP_CONF_DIR in the /etc/environment file.
    • Ubuntu example with MapReduce V1:
    • RedHat/CentOS example with YARN:
    Note: The order of the environment variables in the file does not matter.
  2. Run the following command to activate the environment variables for the current session:
    $ source /etc/environment