Derived from @Luis Alvarado's answer, here is my version for Ubuntu 14.04 and Hadoop 2.5.1
In brief
- Install Java
- Prepare an executive user for Hadoop
hduser
- Switch to
hduser
from now on
- Allow
hduser
to remote via ssh with pass-phrase-less
- Disable IPv6
- Download and config Hadoop package
- Prepare system path $HADOOP_HOME and $JAVA_HOME
- Config Hadoop's services
- Start Hadoop's services
Done. Good luck!
Detail steps
Install Java
Download and install
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install oracle-java7-installer
Make sure you have Java7 installed
$ which java
$ ls -l /usr/bin/java
$ ls -l /etc/alternatives/java
we should have java
point to /usr/lib/jvm/java-7-oracle/jre/bin/java
Prepare an executive user for Hadoop hduser
Create user hduser
in group hadoop
$ sudo addgroup hadoop
$ sudo adduser --ingroup hadoop hduser
Grant hduser
the sudo privilege
Edit sudo
$ sudo visudo
Add to the end this line
hduser ALL=(ALL:ALL) ALL
Switch to hduser
from now on
$ su - hduser
Allow hduser
to remote via ssh with pass-phrase-less
Install openssh
$ sudo apt-get install openssh-server
Generate RSA public/private key for SSH connection; passphrase is empty as parameter -P ""
$ ssh-keygen -t rsa -P ""
$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys
Make sure hduser
can ssh remote locally without a password
$ ssh localhost
Disable IPv6
Edit the configuration file
$ sudo nano /etc/sysctl.conf
Copy to the end
#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Make sure IPv6 is off by a reboot or call
$ sudo sysctl -p
Then call
$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
It should say 1 which means OK ^^
Download and config Hadoop package
Download Hadoop 2.5.1 packages from Apache Hadoop site
The direct URL for this package is this link
http://www.eu.apache.org/dist/hadoop/core/hadoop-2.5.1/hadoop-2.5.1.tar.gz
So let's download to hduser
's home folder, extract it, and rename it to hadoop
$ wget http://www.eu.apache.org/dist/hadoop/core/hadoop-2.5.1/hadoop-2.5.1.tar.gz
$ tar -xvzf hadoop-2.5.1.tar.gz
$ mv hadoop-2.5.1 hadoop
Make sure we have Hadoop stored in hduser
home
$ ls /home/hduser/hadoop
Prepare system path $HADOOP_HOME and $JAVA_HOME
Edit hduser
's .bashrc file
$ nano .bashrc
Put to the end values for $HADOOP_HOME
and $JAVA_HOME
# Set Hadoop-related environment variables
export HADOOP_HOME=/home/hduser/hadoop
# Set JAVA_HOME (we will also configure JAVA_HOME directly for Hadoop later on)
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
Add the Hadoop binary
folders to system $PATH
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
Open a new terminal, log in as hduser
, and make sure you have $HADOOP_HOME with available commands
$ echo $HADOOP_HOME
$ which start-all.sh
$ which start-dfs.sh
$ which start-yarn.sh
We should see the full path of those names.
Config Hadoop's services
Each component in Hadoop is configured using an XML file.
Common properties go in core-site.xml
HDFS properties go in hdfs-site.xml
MapReduce properties go in mapred-site.xml

These files are all located in folder $HADOOP_HOME/etc/hadoop
Define, again, JAVA_HOME in hadoop-env.sh
by edit the line
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
Define Hadoop temp folder
and file system
name in core-site.xml at
<configuration>
...
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hduser/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:54310</value>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
...
</configuration>
We need to prepare this temp folder
as configured at /home/hduser/tmp
$ cd /home/hduser
$ mkdir tmp
$ chown hduser:hadoop tmp
$ chmod 755 tmp
Define file system
's block replication
in hdfs-site.xml
<configuration>
...
<property>
<name>dfs.replication</name>
<value>1</value>
<description>Default block replication.
The actual number of replications can be specified when the file is created.
The default is used if replication is not specified in create time.
</description>
</property>
...
</configuration>
Define map-reduce job
in mapred-site.xml
<configuration>
...
<property>
<name>mapred.job.tracker</name>
<value>localhost:54311</value>
<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.
</description>
</property>
...
</configuration>
Format name node
$ hdfs namenode -format
Start Hadoop service
Call
$ start-dfs.sh && start-yarn.sh
these two commands are located at $HADOOP_HOME/sbin which we have added to system $PATH before.
Make sure Hadoop services are started properly
$ jps
we should see
