Ubuntu – Installing Hadoop in Ubuntu 16.04

16.04hadoopjava

I am pretty new to Ubuntu/linux and totally new to Hadoop.

I'm following the guide here:

https://www.digitalocean.com/community/tutorials/how-to-install-hadoop-in-stand-alone-mode-on-ubuntu-16-04

I an using Java 9.0.1 and am trying to install Hadoop 2.8.2.

It's a very nice guide, but I seem to have hit a snag.

To give some background I did not complete the checksum check in part 2 because the mds link for the version of Hadoop I downloaded appears to be dead.

Also prior to finding the guide above I had a couple of aborted attempts to install java and setting the environmental variables for java! I eventually managed to install java 9.0.1 with SDKMAN.

With these confessions out of the way I can now state the problem:

I'm on step 3 of the guide, when I type:

readlink -f /usr/bin/java | sed "s:bin/java::"

I just get:

/usr/

When I look in my usr/bin file there doesn't even seem to be a java folder?
However there is a java folder in use/local?

Can someone tell me how to complete step 3 "setting the path to Java" with my configuration?

Best Answer

When I type in whereis java it gives: java: /usr/local/java /usr/share/java /home/hugh/.sdkman/candidates/java/9.0.1-oracle/bin/java

The goal of Step 3 is to configure your Java home. Based on your comment above, your Java home is /home/hugh/.sdkman/candidates/java/9.0.1-oracle, this is the value to use as JAVA_HOME in the hadoop-env.sh configuration file. That is:

export JAVA_HOME=/home/hugh/.sdkman/candidates/java/9.0.1-oracle

Let me explain a bit more. The instructions ask you to do readlink -f /usr/bin/java | ... because the page assumes that you have /usr/bin/java symlinked to somewhere. But you don't. Your java is in fact in /usr/local/java, so in your case the equivalent appropriate step would be:

readlink -f /usr/local/java | sed "s:bin/java::"

Where, readlink -f /usr/local/java will output /home/hugh/.sdkman/candidates/java/9.0.1-oracle/bin/java, and the sed command removes the bin/java from it, which leaves you with /home/hugh/.sdkman/candidates/java/9.0.1-oracle.