Under my profile and the .bashrc file. I have added several environment variables. Example:

export HADOOP_HOME=/app/hadoop-2.7.3

When I try to run any "hadoop" command I get command not found.

After executing this command "exec bash" I will be able then to run hadoop commands without issues.

The problem I am having that every time I log in to the server I will need to run the exec command to be able to use hadoop, plus there are other users on the server that need to use the application.

How can I update the PATH globally so everyone can use hadoop and any other installed application?

Thank you

  • "command not found" means PATH is wrong, not HADOOP_HOME. – jordanm Oct 22 '18 at 0:51

Create a file in /etc/profile.d called hadoop.sh.

Add these lines to the file:

export HADOOP_HOME=/app/hadoop-2.7.3
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk

JAVA_HOME also needs to be set in order for Hadoop to function which I've added above assuming you are using Java 1.8.0.

Make the file executable:

chmod +x /etc/profile.d/hadoop.sh

The bin directory for Hadoop will be prepended to everyone's path at login.

  • Need to fix PATH so it includes the original path and not only hadoop's bin! – filbranden Oct 22 '18 at 3:25
  • @FilipeBrandenburger I must have forgotten to copy the entirety when I did it on my test machine! That's a good catch. – Nasir Riley Oct 22 '18 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.