How to install Hadoop in Standalone Machine

  • Step 1: Install the following software before installing Hadoop

    $sudo apt-get update
    $sudo apt-get install sun-java6-jdk
    $sudo update-java-alternatives -s java-6-sun

  • Step 2: Verify the java installation using following command

    $java -version

  • Step 3:Create a Hadoop User

    $sudo addgroup hadoop
    $sudo adduser –ingroup hadoop hduser

  • Step 4: SSH configuration

    $su hduser

    Generate ssh key

    $ssh-keygen -t rsa -P ""

    Enable the SSH access to local machine

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

    Verify ssh configuration using the command


  • Step 5: Disabling IPv6
    Add the following lines to the /etc/sysctl.conf file

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

    To check whether IPv6 is enabled on local machine using the following command

    $cat /proc/sys/net/ipv6/conf/all/disable_ipv6
    A return value of 0 means IPv6 is enabled, a value of 1 means disabled

  • Step 6: Download hadoop from the following link

  • Step 7: Extract hadoop-1.2.1.tar.gz into the /usr/local/ directory using the following command

    $sudo tar xzf hadoop-1.2.1.tar.gz -C /usr/local/

  • Getting Permission to the hadoop user $sudo chown -R hduser:hadoop hadoop-1.2.1
  • Step 8: Set hadoop environment variable as follows

    Modify .bahrcvi /home/admin(system name)/.bashrc

  • Add the following lines to .bashrc file

    # Set Hadoop-related environment variables
    export HADOOP_HOME=/usr/local/hadoop-1.2.1
    # Set JAVA_HOME
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0
    # Some convenient aliases and functions for running Hadoop-related commands
    unalias fs &> /dev/null
    alias fs="hadoop fs"
    unalias hls &> /dev/null
    alias hls="fs -ls"
    # Requires installed 'lzop' command.
    lzohead () {
    hadoop fs -cat $1 | lzop -dc | head -1000 | less
    # Add Hadoop bin/ directory to PATH
    export PATH=$PATH:$HADOOP_HOME/bin

  • Step 9: Configuration of Hadoop directory

    Add the following lines to Hadoop xml filesThese files are contained in following directory$ cd /usr/local/hadoop-1.2.1/conf
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0

    <description>A base for other temporary directories.</description>

    <description>The name of the default file system. </description>


    <description>Default block replication.</description>

    <description>The host and port that the MapReduce job tracker runs at. If "local", then jobs are run in-process as a single map and reduce task.


  • Step 10: Format Hadoop NameNode

    Execute the below command from Hadoop directory
    $hadoop namenode -format

  • Step 11: Start Hadoop Daemons


  • Step 12: Verify the running state of Hadoop daemons

    $jps6146 JobTracker
    6400 TaskTracker
    6541 Jps
    5806 DataNode
    6057 SecondaryNameNode
    5474 NameNode

  • Step 13:Stop Hadoop Daemons

    Stop Hadoop Daemons
    stopping jobtracker stopping tasktracker
    stopping namenode stopping datanode stopping secondarynamenode