4

I installed Hadoop, but I cannot get its version:

ramesh@ramesh-H61M-S2P-B3:~$ echo $HADOOP_HOME
/home/hadoop/work/hadoop-1.1.2
 ramesh@ramesh-H61M-S2P-B3:~$ hadoop -version
hadoop: command not found

What do I have to do, to get Hadoop to work?

Eliah Kagan
  • 117,780
rams
  • 41

4 Answers4

7

You are using the wrong command.

To check hadoop version, type hadoop version in the terminal. Here is the sample output

$ hadoop version
Hadoop 2.4.1
Subversion http://svn.apache.org/repos/asf/hadoop/common -r 1604318
Compiled by jenkins on 2014-06-21T05:43Z
Compiled with protoc 2.5.0
From source with checksum bb7ac0a3c73dc131f4844b873c74b630
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.4.1.jar
Kulfy
  • 17,696
2

cd $HADOOP_HOME or cd $HADOOP_HOME/bin depending on how the product is installed.

In fact, I'm sure that the directory where the hadoop command is installed is not in your PATH.

You can modify the PATH of your account by editing the .bashrc file in your home directory and by putting this line at the end :

export PATH=$PATH:/home/hadoop/work/hadoop-1.1.2

Of course, if the hadoop command is not right under /home/hadoop/work/hadoop-1.1.2, you will have to add the full directory and not limit you to Hadoop home directory.

You can find the right location of hadoop by typing locate hadoop.

Benoit
  • 7,567
  • 1
  • 25
  • 34
1

You need to add the path of the hadoop program to your $PATH variable.

Edit ~/.bashrc and add this line at the end:

export PATH=$PATH:$HADOOP_HOME/bin/

Then do the following to apply the changes we did:

source ~/.bashrc

Now try hadoop version. It should work. Remember that you need Java installed and set its path in conf/hadoop-env.sh (this is part of installing Hadoop).

Alaa Ali
  • 31,535
1

Use $HADOOP_HOME/bin/hadoop version instead of hadoop -version.

VeLKerr
  • 233