How to Install Apache Hadoop on Ubuntu 16.04

r00t April 30, 2018

Install Apache Hadoop on Ubuntu 16.04

In this tutorial we’ll learn how to install Apache Hadoop on Ubuntu 16.04. We will also install and configure its prerequisites. Apache Hadoop is a Java-based programming framework that supports the processing and storage of extremely large datasets on a cluster of inexpensive machines. It was the first major open source project in the big data playing field and is sponsored by the Apache Software Foundation.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Apache Hadoop on Ubuntu 16.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing Java.

As Hadoop is based on Java, we need to install it on our machine:

apt-get -y install openjdk-8-jdk-headless

Step 3. Added a new Hadoop User Group.

It is recommended to create a regular user to configure and run Apache Hadoop. So, create a user named “hadoop” and set a password:

useradd -m -d /home/hadoop -s /bin/bash hadoop
passwd hadoop

Step 4. Installing Apache Hadoop on Ubuntu 16.04.

First, you can visit Apache Hadoop page to download the latest Hadoop package, or you can just issue the following command in terminal to download Hadoop 3.1.0:


Then, we have to use the tar command to extract the file:

tar xvzf hadoop-3.1.0.tar.gz
mv hadoop-3.1.0 hadoop

Step 5. Configure Apache Hadoop.

We will be configuring Hadoop in Pseudo-Distributed mode. To start with, set an environmental variables in the ~/.bashrc file:

### nano ~/.bashrc

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk- # Change it depends on JAVA installation directory
export HADOOP_HOME=/home/hadoop/hadoop # Hadoop installation directory

Apply environmental variables to the current session:

source ~/.bashrc

Next, edit the Hadoop environmental file:

nano $HADOOP_HOME/etc/hadoop/

Set JAVA_HOME environment variable:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-

Hadoop has many configuration files, and we need to edit them depends on the cluster modes we set up (Pseudo-Distributed):

cd $HADOOP_HOME/etc/hadoop

Edit core-site.xml:


Edit hdfs-site.xml:




Edit mapred-site.xml:

cp $HADOOP_HOME/etc/hadoop/mapred-site.xml.template $HADOOP_HOME/etc/hadoop/mapred-site.xml

Edit yarn-site.xml:


Now format the NameNode using the following command:

hdfs namenode -format

Finally, start NameNode daemon and DataNode daemon by using the scripts in the /sbin directory, provided by Hadoop:

cd $HADOOP_HOME/sbin/

Step 6. Configure Firewall for Apache Hadoop.

ufw allow 50070/tcp
ufw allow 8088/tcp
ufw reload

Step 7. Accessing Apache Hadoop.

Apache Hadoop will be available on HTTP port 8088 and port 50070 by default. Open your favorite browser and navigate to ttp://your-ip-address:50070/

Congratulation’s! You have successfully install and configure Apache Hadoop on your Ubuntu 16.04 server. Thanks for using this tutorial for installing Apache Hadoop on Ubuntu system.

The Tags:

Leave a Comment

Comments are closed.