ubuntu 32 hadoop 2.2.0

转载 2013年12月04日 13:24:36

BigData Handler

Handles Velocity,Volume,Variety and Complexity

Installing single node Hadoop 2.2.0 on Ubuntu

Posted on
November 2, 2013
by aravindu012

Please find the complete step by step process for installing Hadoop 2.2.0 stable version on Ubuntu as requested by many of this blog visitors, friends and subscribers.


Apache Hadoop 2.2.0 release has significant changes compared to its previous stable release, which is Apache Hadoop 1.2.1(Setting up Hadoop 1.2.1 can be found here).

 In short , this release has a number of changes compared to its earlier version 1.2.1:

  • YARN – A general purpose resource management system for Hadoop to allow MapReduce and other data processing frameworks like Hive, Pig and Services
  • High Availability for HDFS
  • HDFS Federation, Snapshots
  • NFSv3 access to data in HDFS
  • Introduced Application Manager to manage the application life cycle
  • Support for running Hadoop on Microsoft Windows
  • HDFS – Symlinks feature is disabled & will be taken out in future versions
  • Jobtracker has been replaced with Resource Manager and Node Manager

Before starting into setting up Apache Hadoop 2.2.0, please understand the concepts of Big Data and Hadoop from my previous blog posts:

Big Data Characteristics, Problems and Solution.

What is Apache Hadoop?.

Setting up Single node Hadoop Cluster.

Setting up Multi node Hadoop Cluster.

Understanding HDFS architecture (in comic format).

Setting up the environment:

In this tutorial  you will know step by step process for setting up a Hadoop Single Node cluster, so that you can play around with the framework and learn more about it.

In This tutorial we are using following Software versions, you can download same by clicking the hyperlinks:

If  you are using putty to access your Linux box remotely, please install openssh  by running this command, this also helps in configuring SSH access easily in the later part of the installation:

sudo apt-get install openssh-server


  1. Installing Java v1.7
  2. Adding dedicated Hadoop system user.
  3. Configuring SSH access.
  4. Disabling IPv6.

Before starting of installing any applications or softwares, please  makes sure your list of packages from all repositories and PPA’s is up to date or if not update them by using this command:

sudo apt-get update

1. Installing Java v1.7:

For running Hadoop it requires Java v1. 7+

a. Download Latest oracle Java Linux version of the oracle website by using this command

wget https://edelivery.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz

If it fails to download, please check with this given command which  helps to avoid passing username and password.

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "https://edelivery.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz"



b. Unpack the compressed Java binaries, in the directory:

sudo tar xvzf jdk-7u25-linux-x64.tar.gz


c. Create a Java directory using mkdir under /user/local/ and change the directory to /usr/local/Java by using this command

mkdir -R /usr/local/Java
cd /usr/local/Java


d. Copy the Oracle Java binaries into the /usr/local/Java directory.

sudo cp -r jdk-1.7.0_45 /usr/local/java


e. Edit the system PATH file /etc/profile and add the following system variables to your system path

sudo nano /etc/profile    or  sudo gedit /etc/profile


f. Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/profile file:

export JAVA_HOME
export PATH


g. Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_45/bin/javac" 1
sudo update-alternatvie --set javac /usr/local/Java/jdk1.7.0_45/bin/javac


  • This command notifies the system that Oracle Java JDK is available for use

h. Reload your system wide PATH /etc/profile by typing the following command:

. /etc/profile

Test to see if Oracle Java was installed correctly on your system.

Java -version


2. Adding dedicated Hadoop system user.
We will use a dedicated Hadoop user account for running Hadoop. While that’s not required  but it is recommended, because it helps to separate the Hadoop installation from other software applications and user accounts running on the same machine.

a. Adding group:

sudo addgroup Hadoop

b. Creating a user and adding the user to a group:

sudo adduser –ingroup Hadoop hduser

It will ask to provide the new UNIX password and Information as shown in below image.


3. Configuring SSH access:

The need for SSH Key based authentication is required so that the master node can then login to slave nodes (and the secondary node) to start/stop them and also local machine if you want to use Hadoop with it. For our single-node setup of Hadoop, we therefore need to configure SSH access to localhost for the hduser user we created in the previous section.

Before this step you have to make sure that SSH is up and running on your machine and configured it to allow SSH public key authentication.

Generating an SSH key for the hduser user.
a. Login as hduser with sudo
b. Run this Key generation command:

ssh-keyegen -t rsa -P ""


c. It will ask to provide the file name in which to save the key, just press has entered so that it will generate the key at ‘/home/hduser/ .ssh’

d. Enable SSH access to your local machine with this newly created key.

cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

e. The final step is to test the SSH setup by connecting to your local machine with the hduser user.

ssh hduser@localhost

This will add localhost permanently to the list of known hosts


4. Disabling IPv6.

We need to disable IPv6 because Ubuntu is using IP for different Hadoop configurations. You will need to run the following commands using a root account:

sudo gedit /etc/sysctl.conf

Add the following lines to the end of the file and reboot the machine, to update the configurations correctly.

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


Hadoop Installation:

Go to Apache Downloadsand download Hadoop version 2.2.0 (prefer to download any stable versions)

i. Run this following command to download Hadoop version 2.2.0

wget http://apache.mirrors.pair.com/hadoop/common/stable2/hadoop-2.2..tar.gz


ii. Unpack the compressed hadoop file by using this command:

tar –xvzf hadoop-2.2.0.tar.gz


iii. move hadoop-2.2.0 to hadoop directory by using give command

mv hadoop-2.2.0 hadoop


iv.  Move hadoop package of your choice, I picked /usr/local for my convenience

sudo mv hadoop /usr/local/


v. Make sure to change the owner of all the files to the hduser user and hadoop group by using this command:

sudo chown -R hduser:hadoop Hadoop


Configuring Hadoop:

The following are the required files we will use for the perfect configuration of the single node Hadoop cluster.

a. yarn-site.xml:
b. core-site.xml
c. mapred-site.xml
d. hdfs-site.xml
e. Update $HOME/.bashrc

We can find the list of files in Hadoop directory which is located in

cd /usr/local/hadoop/etc/hadoop



<!-- Site specific YARN configuration properties -->


b. core-site.xml:

i. Change the user to “hduser”. Change the directory to /usr/local/hadoop/conf  and edit the core-site.xml file.

vi core-site.xml

ii. Add the following entry to the file and save and quit the file:



c. mapred-site.xml:

If this file does not exist, copy mapred-site.xml.template as mapred-site.xml

i. Edit the mapred-site.xml file

vi mapred-site.xml

ii. Add the following entry to the file and save and quit the file.



d. hdfs-site.xml:

i. Edit the hdfs-site.xml file

vi hdfs-site.xml

ii. Create two directories to be used by namenode and datanode.

mkdir -p $HADOOP_HOME/yarn_data/hdfs/namenode
sudo mkdir -p $HADOOP_HOME/yarn_data/hdfs/namenode
mkdir -p $HADOOP_HOME/yarn_data/hdfs/datanode

iii. Add the following entry to the file and save and quit the file:



e. Update $HOME/.bashrc

i. Go back to the root and edit the .bashrc file.

vi .bashrc


ii. Add the following lines to the end of the file.

Add below configurations:

# Set Hadoop-related environment variables
export HADOOP_PREFIX=/usr/local/hadoop
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_CONF_DIR=${HADOOP_HOME}/etc/hadoop
# Native Path
export HADOOP_OPTS="-Djava.library.path=$HADOOP_PREFIX/lib"
#Java path
export JAVA_HOME='/usr/locla/Java/jdk1.7.0_45'
# Add Hadoop bin/ directory to PATH


Formatting and Starting/Stopping the HDFS filesystem via the NameNode:

i. The first step to starting up your Hadoop installation is formatting the Hadoop filesystem which is implemented on top of the local filesystem of your cluster. You need to do this the first time you set up a Hadoop cluster. Do not format a running Hadoop filesystem as you will lose all the data currently in the cluster (in HDFS). To format the filesystem (which simply initializes the directory specified by the dfs.name.dir variable), run the

hadoop namenode -format



ii. Start Hadoop Daemons by running the following commands:

Name node:

$ hadoop-daemon.sh start namenode

Data node:

$ hadoop-daemon.sh start datanode

Resource Manager:

$ yarn-daemon.sh start resourcemanager


Node Manager:

$ yarn-daemon.sh start nodemanager

Job History Server:

$ mr-jobhistory-daemon.sh start historyserver


v. Stop Hadoop by running the following command


Hadoop Web Interfaces:

Hadoop comes with several web interfaces which are by default  available at these locations:


By this we are done in setting up a single node hadoop cluster v2.2.0, hope this step by step guide helps you to setup same environment at your end.

Please leave a comment/suggestion in the comment section,will try to answer asap and don’t forget to subscribe for the newsletter and a facebook like :)

Categories: Hadoop


  1. BigData

    Hi, This is a great tutorial. It really helped me. But I have 1 problem, when i type jps after hadoop-daemon.sh start namenode or after hadoop-daemon.sh start datanode I do not get any NameNode printed in the output only some number JPS is printed. So have I done something wrong ?

    • Hi Arundhati

      I am glad that this tutorial helped you.
      Coming to your question/issue: Can you please check whether all the configurations files are configured correctly(setting up Hadoop home directory) or go to change the home directory to hadoop bin(/usr/local/hadoop/bin) directory and run those start commands, it should work.

  2. BigData

    Hi I am getting the error:

    13/11/29 16:12:32 FATAL namenode.NameNode: Exception in namenode join
    java.io.IOException: Cannot create directory /usr/local/hadoop/yarn_data/hdfs/namenode/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:301)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:523)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:544)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:147)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:837)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1213)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1320)
    13/11/29 16:12:32 INFO util.ExitUtil: Exiting with status 1
    13/11/29 16:12:32 INFO namenode.NameNode: SHUTDOWN_MSG:

    • aravindu012


      Can you please check the directory permession:

      Make sure to change the owner of all the files to the hduser user and hadoop group by using this command:
      sudo chown -R hduser:hadoop Hadoop

Leave a Reply


Recent Posts


Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



November 2013
« Oct
  Dec »
  1 2
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26
27 28 29 30  
© BigData Handler. Proudly Powered by WordPress | Nest Theme by YChong


Hadoop 2.2.0 Eclipse插件使用

  • nisxiya
  • nisxiya
  • 2014年11月02日 22:26
  • 836

Hadoop 2.2.0 (单机)安装,配置全过程

(本次安装是在64位 Cent OS的环境下) 1. 创建用户 useradd -d /home/user1 -s /bin/bash user1 2. 安装JDK 2.1 下载JDK版本 注明: 在...
  • windyboy911
  • windyboy911
  • 2014年01月10日 16:24
  • 2170

Hadoop2.2.0--Hadoop Federation、Automatic HA、Yarn完全分布式集群搭建

  • wl101yjx
  • wl101yjx
  • 2014年05月02日 07:08
  • 2795

Ubuntu 编译安装 hadoop 2.2.0

本文属于转载,打patch部分是自己遇到的问题 转自:http://blog.changecong.com/2013/10/ubuntu-%E7%BC%96%E8%AF%91%E5%AE%89%...
  • li385805776
  • li385805776
  • 2013年12月11日 20:49
  • 2375


获取Job对象Job的构造函数最直接的获取Job对象的方式@Deprecated public Job() throws IOException { this(new Configurat...
  • u014265088
  • u014265088
  • 2017年02月28日 10:18
  • 198


Good news for Hadoop developers who want to use Microsoft Windows OS for their development activitie...
  • jiutianhe
  • jiutianhe
  • 2013年12月30日 20:28
  • 9273

大数据基础(五)从零开始安装配置Hadoop 2.7.2+Spark 2.0.0到Ubuntu 16.04

从零开始安装配置Hadoop 2.7.2+Spark 1.6.2 0 install ubuntu 14.04.01 desktop x64 1 system基础配置 《以下都是root模式》 ...
  • dst1213
  • dst1213
  • 2016年07月25日 21:43
  • 5417


centos6.5下hadoop2.2.0的8节点配置兼动态添加节点测试 测试环境:硬件dell服务器 centos6.5 32位迷你版 hadoop2.2.0官方下载...
  • srnpr
  • srnpr
  • 2013年12月16日 20:07
  • 1400

基于Hadoop 2.2.0的高可用性集群搭建步骤(64位)

内容概要: CentSO_64bit集群搭建, hadoop2.2(64位)编译,安装,配置以及测试步骤 新版亮点: 基于yarn计算框架和高可用性DFS的第一个稳定版本。 注1:官网只提供32位...
  • h348592532
  • h348592532
  • 2013年11月22日 09:44
  • 5885

Hadoop 2.2.0集群搭建

一、环境说明 1、虚拟机平台:VMware10 2、Linux版本:ubuntu-12.04.3-desktop-i386 3、JDK:jdk1.7.0_51 4、Hadoop版本:2.2.0 5、集...
  • liyong199012
  • liyong199012
  • 2014年04月18日 15:22
  • 7161
您举报文章:ubuntu 32 hadoop 2.2.0