Saturday, February 27, 2016

Install Hadoop on Ubuntu (Single-Node Cluster)

In this tutorial I will describe the required steps for setting up a single-node Hadoop cluster which running on Ubuntu 15.04.

According to wiki in simple Hadoop is a framework written in Java for running applications which stand in Big Data analysis.

The main goal of this tutorial is avoiding common mistakes on Hadoop installation in Ubuntu(Linux) environment

In future i'll describe install and configure HIVE and SCOOP in addition HIVE-SQOOP with MySQL.

  • Ubuntu 15.04 with Internet connectivity
  • Java (Open JDK or Oracle Java)

Steps in brief 

  • Install and configure Java
  • Install and configure SSH
  • Install and configure Hadoop
  • Configure System variables
  • Configure Hadoop variables

Install and Configure Java

In this tutorial i'll use Open JDK , you can use Oracle java instead of Open JDK 

Oracle JAVA(via apt-get)
Open the terminal and enter below command step by step
  • sudo apt-get install python-software-properties
  • sudo add-apt-repository ppa:ferramroberto/java
  • sudo apt-get update
  • sudo apt-get install sun-java6-jdk
  • sudo update-java-alternatives -s java-6-sun
The full JDK which will be placed in /usr/lib/jvm/java-6-sun

Open JDK(via apt-get)

  • sudo apt-get update
  • sudo apt-get install default-jdk
  • sudo update-alternatives --config java
The full JDK which will be placed in /usr/lib/jvm/java-7-openjdk-i386

Install and Configure SSH

  • sudo apt-get install ssh
  • sudo apt-get install rsync
  • ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
  • cat ~/.ssh/ >> ~/.ssh/authorized_keys

Install and Configure HADOOP(2.7)

  • wget -c
  • sudo tar -zxvf hadoop-2.7.0.tar.gz
  • sudo mv hadoop-2.7.0 hadoop
  • sudo chmod 777 hadoop
  • sudo mv hadoop /usr/local/hadoop

Configure System variables

Enter following command and paste below lines then save and exit
  • sudo nano ~/.bashrc
Paste below lines then save and exit (Ctrl+x)

#Hadoop Variables
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

For applying system wide changes enter one of below commands
  • bash
  • source ~/.bashrc

Configure Hadoop variables

  • cd /usr/local/hadoop/etc/hadoop
Edit following configuration files and do the below modifications 
  • sudo nano
          #The java implementation to use.
          export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"

  • sudo nano core-site.xml


  • sudo nano yarn-site.xml
                      <value> org.apache.hadoop.mapred.ShuffleHandler</value>

  • sudo cp mapred-site.xml.template mapred-site.xml
  • sudo nano mapred-site.xml

  • sudo nano hdfs-site.xml

  • cd
  • mkdir -p /usr/local/hadoop/hadoop_data/hdfs/namenode
  • mkdir -p /usr/local/hadoop/hadoop_data/hdfs/datanode
  • sudo chown kavinda:kavinda -R /usr/local/hadoop (your user name)
  • hdfs namenode -format

Up and Running the Hadoop cluster

  • (start hadoop)
  • jps (check the status)
  • in your web browser enter below addresses
    • localhost:8088
    • localhost:50070
  • (stop hadoop)

Sinhala Support


Designed By Seo Blogger Templates