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:
      JAVA_HOME=/usr/lib/jvm/<version>
      HADOOP_CONF_DIR=/opt/mapr/hadoop/hadoop-<version>/conf
    • RedHat/CentOS example with YARN:
      JAVA_HOME=/usr/java/<version>
      HADOOP_CONF_DIR=/opt/mapr/hadoop/hadoop-<version>/etc/hadoop/
    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