Installing hadoop 2.4.0 on Ubuntu server

First of all, THESE ARE IMPORTANT FOR INDRODUCTION

*Ubuntu server 14.04
*VM in VirtualBox with 1GB RAM
*SWAP SPACE :   SELECT  more than 2 GB

Up-to-date system.
[crayon-6ae1e7f5843c4217766672/]
Moreover, it is advisable not to run Hadoop services through a general-purpose user, so the next step consists in adding a group hadoop and a user hadoop-user belonging to that group
[crayon-6ae1e7f5843d0833651718/]

Installing Java
The mentioned tutorials suggest a potentially unsafe procedure in order to install the jdk through apt-get,

[crayon-6ae1e7f5843d2486376985/]
Finally, a couple of environment variables should be set up so that the java executables are in $PATH and hadoop knows where java has been installed: this is easily accomplished adding
[crayon-6ae1e7f5843d3286558996/]
at the end of /etc/profile  <<< We need to edit that to set automatically JAVA PATH 
[crayon-6ae1e7f5843d4515335615/]

Setup SSH

All communications with Hadoop are encrypted via SSH, thus the corresponding server should be installed:
[crayon-6ae1e7f5843d6435148070/]
 

and the hadoop-user must be associated to a key pair and subsequently granting its access to the local machine:
[crayon-6ae1e7f5843d7146224198/]
 

Now hadoop-user should be able to access via ssh to localhost without ( WE SET THE PASS = “null”)providing a password:
[crayon-6ae1e7f5843d8291158440/]
 

Disable IPV6

Hadoop and IPV6 do not agree on the meaning of 0.0.0.0 address,

LOOK AT : ??>>>>> /etc/sysctl.conf
[crayon-6ae1e7f5843d9326775122/]
REBOOT SYSTEM

CONTROL
[crayon-6ae1e7f5843db643849730/]

Hadoop

Download and install Hadoop

Download hadoop-2.4.0.tar.gz, unpack it and move the results in /usr/local, adding a symlink using the more friendly name hadoop and changing ownership of the directory contents to the hadoop-user user:
[crayon-6ae1e7f5843dc474089219/]

Setup the dedicated user environment
Switch to the hadoop-user user and add the following lines at the end of ~/.bashrc:

[crayon-6ae1e7f5843dd644541566/]
To have the new environment variables in place,

1- reload .bashrc   through “source .bashrc"

2- then open /usr/local/hadoop/etc/hadoop/hadoop-env.sh ,

3- uncomment the line setting JAVA_HOME and set its value to the jdk directory:
[crayon-6ae1e7f5843de816306619/]

Configure Hadoop

Before being able to actually use the hadoop file system it is necessary to modify some configuration files inside /usr/local/hadoop/etc/hadoop
All such files follow the an XML format, and the updates should concern the top-level node configuration
(likely empty after the hadoop installation). Specifically:

  • in yarn-site.xml :
    [crayon-6ae1e7f5843df739224582/]
  • look in core-site.xml:
    [crayon-6ae1e7f5843e1415348376/]
  • look in mapred-site.xml
    [crayon-6ae1e7f5843e2096699660/]
  • nano hdfs-site.xml:
    [crayon-6ae1e7f5843e3359817604/]

Run these commands.
[crayon-6ae1e7f5843e5987745722/]

Formatting the distributed file system

USER should be  hadoop user 
[crayon-6ae1e7f5843e6809801629/]
Find the  these 2 file  and  run 

start-dfs.sh

start-yarn.sh 
[crayon-6ae1e7f5843e7301111526/]
[crayon-6ae1e7f5843e8744934456/]