============================================================

INSTALL APACHE SQOOP

Date: Wed Jan 21 12:45:34 PM EST 2026
OS: Linux
Platform: Rocky 9
Sqoop Version: 1.4.7
Hadoop Version: 3.3.6
============================================================

Step 1: Download and Extract
============================

# As root, get sources

  wget -P /tmp https://archive.apache.org/dist/sqoop/1.4.7/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz

# Next extract the package in /opt:

  mkdir -p /opt/
  tar xvzf /tmp/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C /opt

Step 2: Set up the Environment
==============================

# We need to add a bunch of fake defines to fool Sqoop so we don't get warnings every time
# it is invoked.

# Important: If you install any of these packages, remove the fake define.
# make the fake path

  mkdir -p /opt/dummy

# Create the profile.d file. sqoop.sh will create dummy environmental variables
# to satisfy Sqoop at start-up. Checks for Zookeeper and HBase instals in
# /opt/services, if they don't exist, then sets the HBASE_HOME and ZOOKEEPER_HOME 
# envronement varilable to /opt/dummy 

  cp files/sqoop.sh /etc/profile.d/sqoop.sh

# Create a sqoop user and change ownership of sqoop and dummy directories  (do as root)

  useradd -g hadoop sqoop
  chown -R sqoop:hadoop /opt/sqoop-1.4.7.bin__hadoop-2.6.0
  chown -R sqoop:hadoop /opt/dummy

# Sqoop can be tested by running the following (only need to source if you have not exited and re-logged in)

  source /etc/profile.d/sqoop.sh
  sqoop version

Step 3: Download the MySQL Driver and Libraries
===============================================

# Download  Libraries and MySQL connector (note: using old MySQL version instead of
# new MariaDB)

# move to sqoop lib directory

  cd /opt/sqoop-1.4.7.bin__hadoop-2.6.0/lib

# get missing library, extract, link (only needed library)

  wget https://downloads.apache.org/commons/lang/binaries/commons-lang-2.6-bin.tar.gz
  tar xvzf commons-lang-2.6-bin.tar.gz commons-lang-2.6/commons-lang-2.6.jar
  ln -s commons-lang-2.6/commons-lang-2.6.jar commons-lang-2.6.jar

# clean up tar file

  rm commons-lang-2.6-bin.tar.gz

# Get, extract, and link the MySQL connector 

  wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz

  tar xvzf mysql-connector-java-5.1.46.tar.gz mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar
  ln -s mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar mysql-connector-java.jar

# clean up tar file

  rm mysql-connector-java-5.1.46.tar.gz

# As root, set ownership to Sqoop

  chown -R sqoop:hadoop /opt/sqoop-1.4.7.bin__hadoop-2.6.0/lib


Step 4: Set up the World Database
=================================

# Download world database (optional) The world.sql data is included in the files directory

  wget https://downloads.mysql.com/docs/world-db.tar.gz
  
# start mysql (MariaDB) and create/import world database

   mysql -u root
   MariaDB [(none)]>  CREATE DATABASE world;
   MariaDB [(none)]>  USE world;
   MariaDB [world]> SOURCE world.sql;
   MariaDB [world]> SHOW TABLES;

   +-----------------+
   | Tables_in_world |
   +-----------------+
   | City            |
   | Country         |
   | CountryLanguage |
   +-----------------+
   3 rows in set (0.00 sec)

# Grant permissions to Sqoop user with password sqoop

   MariaDB [world]> GRANT ALL PRIVILEGES ON world.* To 'sqoop'@'localhost' IDENTIFIED BY 'sqoop';
