Apache Hadoop Tutorial – We shall learn to install Apache Hadoop on Ubuntu. Java is a prerequisite to run Hadoop.

Install Apache Hadoop on Ubuntu

Following is a step by step guide to Install Apache Hadoop on Ubuntu

  1. Install Java

    Hadoop is an open-source framework written in Java. So, for Hadoop to run on your computer, you should install Java in prior. Open a terminal and run the following command :

    hadoopuser@tutorialkart:~$sudo apt-get install default-jdk

    To verify the installation of Java, run the following command in the terminal :

    hadoopuser@tutorialkart:~$java -version

    Output would be as shown below :

  2. Install Hadoop

    Download latest Hadoop binary package from [http://hadoop.apache.org/releases.html].

    Look for latest stable release (not in alpha channel) and click on binary link provided for the release.

    Install Apache Hadoop on Ubuntu - Apache Hadoop Tutorial - www.tutorialkart.comClick on the first mirror link

    Install Apache Hadoop on Ubuntu - Apache Hadoop Tutorial - www.tutorialkart.com

    Copy the downloaded tar file to /usr/lib/ and untar.

    hadoopuser@tutorialkart:~$sudo cp hadoop-2.8.1.tar.gz /usr/lib/ hadoopuser@tutorialkart:/usr/lib$sudo tar zxf hadoop-2.8.1.tar.gz hadoopuser@tutorialkart:/usr/lib$sudo rm hadoop-2.8.1.tar.gz

    Provide the password if asked.

  3. Set Java and Hadoop Path

    Make sure you have the PATHs set up for Java and Hadoop in bashrc file. Open a Terminal and run the following command to edit bashrc file.

    hadoopuser@tutorialkart:~$sudo nano ~/.bashrc

    Paste the following entries at the end of .bashrc file.

    #HADOOP VARIABLES START exportJAVA_HOME=/usr/lib/jvm/default-java/jre exportHADOOP_INSTALL=/usr/lib/hadoop-2.8.1 export PATH=$PATH:$HADOOP_INSTALL/bin export PATH=$PATH:$HADOOP_INSTALL/sbin exportHADOOP_MAPRED_HOME=$HADOOP_INSTALL exportHADOOP_COMMON_HOME=$HADOOP_INSTALL exportHADOOP_HDFS_HOME=$HADOOP_INSTALL exportYARN_HOME=$HADOOP_INSTALL exportHADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native exportHADOOP_OPTS=”-Djava.library.path=$HADOOP_INSTALL/lib” #HADOOP VARIABLES END
  4. Run Hadoop

    After setting up the path for Hadoop and Java, you may run the hadoop  command, from anywhere, using the terminal.

    hadoopuser@tutorialkart:~$hadoop

    The output would be as shown below :

Conclusion :

In this Apache Hadoop Tutorial, we have successfully installed Hadoop on Ubuntu. In subsequent tutorials, we shall look into HDFS and MapReduce and start with Word Count Example in Hadoop.