Build Local Single Node Hadoop Cluster on Linux

This post shows how to build a local single node Hadoop cluster on Linux.


(1) Install JDK , Download Link

(2) install ANT, Download Link

Use the bin version, and add the following lines in your

export PATH=${PATH}:${ANT_HOME}/bin


Install Hadoop:

(1) Download Hadoop, Download Link

(2) uncompress the file, move the folder to wherever you want, I use ~/hadoop/

(3) enter ~/hadoop/, run


(4) Put localhost in two files, conf/masters and conf/slaves:

echo localhost > conf/masters;
echo localhost > conf/slaves;

(5) In conf/core-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

(6) In conf/mapred-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>


(7) edit conf/, uncomment the JAVA_HOME line, and put the right path for JDK


(8) Run Hadoop !



After Running:

(1) Check that the daemons are running using jps (shows java processes):


Should show 5 processes and Jps (and maybe more if you are running e.g. Eclipse):

17400 SecondaryNameNode
17172 NameNode
17599 TaskTracker
17279 DataNode
17493 JobTracker
17699 Jps

Check the local NameNode: http://localhost:50070/dfshealth.jsp should show one live node.

Check the local JobTracker: http://localhost:50030/jobtracker.jsp should show ‘State: RUNNING’, not ‘INITIALIZING’.

If the Namenode is not running, format the Namenode, and run again:

rm -r /tmp/hadoop-*;
bin/hadoop namenode -format;

This can be caused by switching Hadoop versions.
(2) Sanity test

hadoop fs -ls /

(3) Word Count Example:

Please Look Here

3 thoughts on “Build Local Single Node Hadoop Cluster on Linux

  1. Pingback: Wordcount mapreduce example using Hive on local and EMR « 大春饵的博客

Leave a Reply

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