How do you install Hadoop on Linux SUSE?

Updated on 1/1/18
You may want to see this different posting that works for Linux SUSE as well as other non-SUSE distributions of Linux.

Problem scenario

You want to install the open source version of Hadoop 3.0.0 on Linux SUSE 12 SP3.  What do you do?

Solution
These directions would work on a non-SUSE distribution if you install Java a different way from the first command in the script.  This script requires that your AWS SUSE Linux server is in a security group that has access to the Internet.  But this script should work if your server is not in AWS.  The script takes approximately three minutes to run.  But bandwidth and resources on your instance may vary.

1.  Create a file called installer.sh in /tmp/ with the following content:

zypper -n install java
curl http://www.apache.org/dist/hadoop/core/current/hadoop-3.0.0.tar.gz > /usr/bin/hadoop-3.0.0.tar.gz
cd /usr/bin
tar -xzvf hadoop-3.0.0.tar.gz

var1=$(find / -name hadoop-env.sh)
var2=$(cat $var1 | grep -ic JAVA_HOME)
echo "******************************"
echo "You will have to call the full directory path to hadoop or hdfs to run the commands."
echo "******************************"
echo "There are "$var2" instances of JAVA_HOME in "$var1
echo "You need to comment out uncommented JAVA_HOME stanza(s), if any, in "$var1
echo "Then you need to add this stanza"
echo 'export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")'

2.  Run the installation script:  sudo bash /tmp/installer.sh

3.  Modify hadoop-env.sh in two ways.  First, make sure "JAVA_HOME" stanzas (lines with "JAVA_HOME") are commented out.  Second, make sure you have one that is uncommented like this:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")

4.  Test it with these two commands:

/usr/bin/hadoop-3.0.0/bin/hadoop version
/usr/bin/hadoop-3.0.0/bin/hdfs version

Leave a comment

Your email address will not be published. Required fields are marked *