0

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

1
  • "command not found" means PATH is wrong, not HADOOP_HOME. Commented Oct 22, 2018 at 0:51

1 Answer 1

2

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
export PATH=$HADOOP_HOME/bin:$PATH

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.

2
  • Need to fix PATH so it includes the original path and not only hadoop's bin! Commented Oct 22, 2018 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. Commented Oct 22, 2018 at 5:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.