bashubuntuhadoopubuntu-14.04.profile

/.profile vs. /.bashrc for hadoop variables on ubuntu14.04


I am installing apache hadoop 2.7 on Ubuntu 14.04. In order to make sure hadoop variables are available every time Ubuntu starts, should I modify /.profile or /.bashrc? by hadoop variables I mean:

JAVA_HOME=/usr/local/java/jdk1.7.0_40
PATH=$PATH:$JAVA_HOME/bin JRE_HOME=/usr/local/java/jre1.7.0_40
PATH=$PATH:$JRE_HOME/bin HADOOP_INSTALL=/home/ {user_name}/hadoop/hadoop-1.2.1
PATH=$PATH:$HADOOP_INSTALL/bin
export JAVA_HOME
export JRE_HOME
export PATH

Thank you AA


Solution

  • For global variables (i.e. all users), you should put them into a new file under /etc/profile.d/, for example: /etc/profile.d/hadoop2-7.sh. Permissions should be 0644 (user: rw-, group: r--, other: r--).

    Hope this helps you out.