Set Environment Variables for the Current User

Procedure

  1. Set JAVA_HOME the path of the Java directory.
    • Ubuntu example:
      $ export JAVA_HOME=/usr/lib/jvm/<version>
    • RedHat/CentOS example:
      $ export JAVA_HOME=/usr/java/<version> 
  2. Set HADOOP_CONF_DIR to the path of the directory containing the Hadoop configuration parameters.
    • MapReduce V1 example:
      $ export HADOOP_CONF_DIR=/opt/mapr/hadoop/hadoop-<version>/conf
    • YARN example:
      $ export HADOOP_CONF_DIR=/opt/mapr/hadoop/hadoop-<version>/etc/hadoop/

Results

NOTE: A user who doesn't have root or sudo permissions can add these environment variable entries to the ~/.bashrc file so that the environment variables will be set each time the user logs in.