Skip to content

Instantly share code, notes, and snippets.

@eliasah
Last active August 29, 2015 14:00
Show Gist options
  • Save eliasah/d6394a3a1edf3152409c to your computer and use it in GitHub Desktop.
Save eliasah/d6394a3a1edf3152409c to your computer and use it in GitHub Desktop.
This script will install Hadoop Packages like Hive, Pig, Sqoop
#!/bin/bash
if [ -e hadoop-2.4.0-src.tar.gz ]; then
echo "Skipping Apache Hadoop 2.4 download"
else
echo "Downloading Apache Hadoop 2.4"
wget "http://apache.crihan.fr/dist/hadoop/common/current/hadoop-2.4.0-src.tar.gz"
tar xzvf hadoop-2.4.0-src.tar.gz
cd hadoop-*
mvn package -Pdist,native -Dskiptests -Dtar
mv hadoop-2.4.0 hadoop
cd ~
fi
if [ -e apache-hive-0.13.0-bin.tar.gz ]; then
echo "Skipping Apache Hive download"
else
echo "Downloading Apache Hive"
wget "http://mir2.ovh.net/ftp.apache.org/dist/hive/stable/apache-hive-0.13.0-bin.tar.gz"
fi
if [ -e ./pig-0.12.1.tar.gz ]; then
echo "Skipping Apache Pig download"
else
echo "Downloading Apache Pig"
wget "http://apache.lehtivihrea.org/pig/stable/pig-0.12.1.tar.gz"
fi
if [ -d apache-hive-0.13.0-bin ]; then
echo "Skipping Apache Hive package extraction"
else
tar xzf apache-hive-*.tar.gz
fi
if [ -d pig-0.12.1 ]; then
echo "Skipping Apache Pig package extraction"
else
tar xzf pig-*.tar.gz
fi
# installing Apache Sqoop 1.4.4
if [ -e ./sqoop-1.4.4.tar.gz ]; then
echo "Skipping Apache Sqoop download"
else
echo "Downloading Apache Sqoop"
wget "http://apache.lehtivihrea.org/sqoop/1.4.4/sqoop-1.4.4.tar.gz"
fi
if [ -d sqoop-1.4.4 ]; then
echo "Skipping Apache Sqoop package extration"
else
tar xzf sqoop-*.tar.gz
mv sqoop-1.4.4/ sqoop/
echo "#Add Sqoop bin/ directory to PATH" >> ~/.bashrc
echo "export SQOOP_HOME=./sqoop/" >> ~/.bashrc
echo "export PATH=$PATH:$SQOOP_HOME/bin" >> ~/.bashrc
source ~/.bashrc
echo "adding mysqlj-connector to Sqoop"
wget "http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.tar.gz"
tar xzf mysql-connector-java-5.1.30.tar.gz
mv mysql-connector-java-*.tar.gz archive/
cd mysql-connector-java-5.1.30/
cp mysql-*.jar ~/sqoop/lib/
rm -Rf mysql-connector-java-5.1.30/
cd sqoop/
ant mvn-install
cd ~
fi
mv *.tar.gz archive/
rm -f *~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment