Sqoop Installation – Steps to Install Sqoop 1.4.5 on Linux

1. Sqoop Installation – Objective

In this Sqoop Tutorial, we study “Sqoop Installation” explains all the steps to install Sqoop on Linux. Since we know Sqoop is Hadoop’s sub-project. Thus, it can only work on a Linux operating system. Hence, at first, we will see the installation of some prerequisites to run Sqoop 1.4.5 Installation. So, for that, we will start with steps to verify Java Installation. At last, we will see steps to install Hadoop. Then we will learn the steps for Sqoop Installation on your Linux system.

So, let’s start Sqoop installation.

Sqoop Tutorial - Sqoop Installation

Sqoop Tutorial – Sqoop Installation

2. Java Installation

Before Sqoop installation – version 1.4.5 on Linux, at very first we need to have Java installed on our system.
In order to install Java on our system, we need to follow various steps given below.
Step 1
By visiting the following link, download Java (JDK <latest version> – X64.tar.gz).
Hence,  jdk-7u71-linux-x64.tar.gz will be downloaded on our system.
Step 2
Basically, we find the downloaded Java file in the downloads folder. So, by using the following commands verify it and extract the jdk-7u71-linux-x64.gz file.
$ cd Downloads/
$ ls
jdk-7u71-linux-x64.gz
$ tar zxf jdk-7u71-linux-x64.gz
$ ls
jdk1.7.0_71 jdk-7u71-linux-x64.gz
Step 3
Then, we have to move it to the location “/usr/local/”, to make Java available to all the users. So, open root, and type the following commands.
$ su
password:
# mv jdk1.7.0_71 /usr/local/java
# exitStep IV:
Step 4
Afterward, add the following commands to ~/.bashrc file in order to set up PATH and JAVA_HOME variables.
export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin
Now apply all the changes to the current running system.
$ source ~/.bashrc
Step 5
Now to configure Java alternatives use the following commands 
# alternatives –install /usr/bin/java java usr/local/java/bin/java 2
# alternatives –install /usr/bin/javac javac usr/local/java/bin/javac 2
# alternatives –install /usr/bin/jar jar usr/local/java/bin/jar 2
# alternatives –set java usr/local/java/bin/java
# alternatives –set javac usr/local/java/bin/javac
# alternatives –set jar usr/local/java/bin/jar
So, by using the following command, let’s verify Java installation.
$ java –version
However, we get to see the following response, if Java is already installed on your system
java version “1.7.0_71”
Java(TM) SE Runtime Environment (build 1.7.0_71-b13)
Java HotSpot(TM) Client VM (build 25.0-b02, mixed mode)

Get the most demanding skills of IT Industry - Learn Hadoop

3. Hadoop Installation

It is very important that before Sqoop installation, Hadoop is installed on our system. Follow these steps if Hadoop is not installed on your system:
a. Download Hadoop
By using the following commands, download and extract Hadoop 2.4.1 from Apache Software Foundation.
$ su
password:
# cd /usr/local
# wget http://apache.claz.org/hadoop/common/hadoop-2.4.1/
hadoop-2.4.1.tar.gz
# tar xzf hadoop-2.4.1.tar.gz
# mv hadoop-2.4.1/* to hadoop/
# exit
So, let’s verify the Hadoop installation by using following commands
$ hadoop version
We will get the following response if Hadoop is already installed on your system
Hadoop 2.4.1

Subversion https://svn.apache.org/repos/asf/hadoop/common -r 1529768
Compiled by hortonmu on 2013-10-07T06:28Z
Compiled with protoc 2.5.0
From source with checksum 79e53ce7994d1628b240f09af91e1af4
Hence, in this way, we can download Hadoop.

Hadoop Quiz

4. Sqoop Download – Sqoop Installation

Basically, we can download the latest version of Sqoop from hereDownload sqoop
For this Sqoop Installation tutorial, we are using version 1.4.5, that is,
sqoop-1.4.5.bin__hadoop-2.0.4-alpha.tar.gz.

Step 1- Sqoop Installation

However, to extract the Sqoop tarball and move it to “/usr/lib/sqoop” directory we use the following command.
$tar -xvf sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz
$ su
password:
# mv sqoop-1.4.4.bin__hadoop-2.0.4-alpha /usr/lib/sqoop
#exit

Step 2- Configuring bashrc

Also, by appending the following lines to ~/.bashrc file we have to set up the Sqoop environment 
#Sqoop
export SQOOP_HOME=/usr/lib/sqoop export PATH=$PATH:$SQOOP_HOME/bin
Now, to execute ~/.bashrc file we use the following command.
$ source ~/.bashrc

Step 3: Configuring Sqoop

While, we need to edit the sqoop-env.sh file, that is placed in the $SQOOP_HOME/conf directory, in order to configure Sqoop with Hadoop. Now, using the following command redirect to Sqoop config directory and copy the template file 
$ cd $SQOOP_HOME/conf
$ mv sqoop-env-template.sh sqoop-env.sh
Also, open sqoop-env.sh and edit the following lines 
export HADOOP_COMMON_HOME=/usr/local/hadoop
export HADOOP_MAPRED_HOME=/usr/local/hadoop

Step 4: Download and Configure MySQL-connector-java

From the following link, we can download MySQL-connector-java-5.1.30.tar.gz file.
In adddition, to extract MySQL-connector-java tarball and move MySQL-connector-java-5.1.30-bin.jar to /usr/lib/sqoop/lib directory we use the following command.
$ tar -zxf mysql-connector-java-5.1.30.tar.gz
$ su
password:
# cd mysql-connector-java-5.1.30
# mv mysql-connector-java-5.1.30-bin.jar /usr/lib/sqoop/lib

Step 5: Verifying Sqoop

At last, to verify the Sqoop version we use the following command.
$ cd $SQOOP_HOME/bin
$ sqoop-version
Expected output
14/12/17 14:52:32 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5
Sqoop 1.4.5 git commit id 5b34accaca7de251fc91161733f906af2eddbe83
Compiled by abe on Fri Aug 1 11:19:26 PDT 2014
Hence, in this way Sqoop installation is complete.

5. Conclusion

Hence, in this Sqoop installation tutorial, we study how Sqoop download & install Sqoop by verifying Java Installation. At last, how to Download Hadoop and Verifying Hadoop Installation. Furthermore, if you feel any query regarding Sqoop installation, feel free to ask in the comment section.
See Also- Sqoop Eval & Sqoop Codegen
For reference

Leave a Reply

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