Installing Apache
Hadoop (single node)
http://hadoop.apache.org/docs/current/
Mail: [email protected] skype: Enrique.Davila.gutierrez
Agenda
1. Setting up the environment
2. Configuring Hadoop
3. Running hadoop
Prerequisites
Linux Distribution
Java must be installed
SSH must be installed and running
Do I have Java?
Type on shell: java version
As follow:
The screen below shows we dont have java Installed
Installing Java
Type the following command
sudo apt-get install openjdk-7-jdk
Do you want to Continue? Type Y and then Enter
Java is downloading, see the progress at
the bottom, will install it automatically
Verify Installation
type $java -version and you will see the message below:
Where is my java Installed?
Go to /usr/lib/jvm typing cd /usr/lib/jvm/
Install SSH Server
Assuming SSH is not installed in our server, you can type:
sudo apt-get install openssh-server
Type Y and hit Enter
Restart the Service
To Start/Restart SSH Service Type:
sudo service ssh restart
Verify SSH is working
Type:
ssh localhost
You will be prompted for a password
Download and Install hadoop
Go http://hadoop.apache.org/ then Downloads
Or http://hadoop.apache.org/releases.html
Select 2.5.2 and Select Binay
Downloading Hadoop
1. On your terminal go to: /home/Hadoop (Hadoop is my home directory)
2. Type wget and paste the link you just copied from the Hadoop web page below:
3. See next slide with sample or copy the command below:
wget http://www.eu.apache.org/dist/hadoop/common/hadoop-2.5.2/hadoop-2.5.2.tar.gz
Right Click over this link and copy
link address:
Downloading hadoop (see the progress)
Copying hadoop tar file to our
workspace
Type ls al, you will see your tar file we just downloaded with the hadoop
files
Untar the Tarball
Type:
Sudo tar xvf hadoop-2.5.2.tar.gz C /usr/local/
This command will put all the content from tar file into the sub folder /local
Go to /usr/local/
Typing: cd /usr/local/
Type ls and you will see new folder: hadoop-2.5.2
Type:
cd hadoop-2.5.2
In the picture you will see all the content
within Hadoop folder
Setting up hadoop
Add two new variables to the bash with the commands below:
In terminal window Type:
sudo nano ~/.bashrc
At the bottom of the page type:
export HADOOP_HOME=/usr/local/hadoop-2.5.2/
export PATH=$PATH:$HADOOP_HOME/bin
Then press CTRL + x and then enter to save the changes
Setup Java on Hadoop Env
Need to tell to hadoop where is java installed
Go to:
/usr/local/hadoop-2.5.2/etc/hadoop
Edit the file hadoop-env.sh
Type:
sudo nano hadoop-env.sh
Look for JAVA_HOME line
Set the variable JAVA_HOME with the
Java Location on your machine
Test variables are set
Edit the xml configuration files
We are going to set the right values on the following files:
In the path /usr/local/hadoop-2.5.2/etc/hadoop/
core-site.xml
hdfs-site.xml
Edit core-site.xml values
hdfs-site.xml values
hdfs-site.xml values
Apply HDFS format
Go to:
/usr/local/hadoop-2.5.2/bin
Type: hdfs namenode -format
Was format successful? Check for this
line:
Start the node:
Go to /usr/local/hadoop-2.5.2/sbin
Type: