Skip to content

Instantly share code, notes, and snippets.

@paladini
Last active September 16, 2015 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paladini/5a04e8c01c6ab3623a98 to your computer and use it in GitHub Desktop.
Save paladini/5a04e8c01c6ab3623a98 to your computer and use it in GitHub Desktop.
Installation script for Spark on the default image of Fedora 22. Will install and configure everything: Oracle JDK, Maven 3.3.3, Scala 2.10.5 and Spark 1.5.0.
#!/bin/sh
# Install Spark on Fedora 22.
# Written by Fernando Paladini on 09/15/2015.
arch=$(uname -m)
mkdir $HOME/iot
cd $HOME/iot
# Installing and configuring Oracle JDK 8.
if [ "$arch" == "x86_64" ]
then
printf "\n\n[LOG] x86_64 architecture detected. Installing Oracle JDK 8 x86_64. \n\n"
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm > jdk-8u60-linux-x64.rpm
sudo rpm -ivh jdk-8u60-linux-x64.rpm
else
printf "\n\n[LOG] i686 architecture detected. Installing Oracle JDK 8 i586.\n\n"
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-i586.rpm > jdk-8u60-linux-i586.rpm
sudo rpm -ivh jdk-8u60-linux-i586.rpm
fi
printf "\n\n[LOG] Installing Java on 'alternatives'.\n\n"
sudo alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
sudo alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
sudo alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
printf "\n\n[LOG] Configuring Java on 'alternatives'.\n\n"
sudo alternatives --config java
# Installing Scala
printf "\n\n[LOG] Start installing Scala 2.10.5.\n\n"
curl -O http://downloads.typesafe.com/scala/2.10.5/scala-2.10.5.rpm
sudo rpm -ivh scala-2.10.5.rpm
# Installing and configuring Maven
printf "\n\n[LOG] Start installing Maven 3.3.3. Please, be patient, it will provide you the whole internet.\n\n"
curl -O http://ftp.unicamp.br/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
tar -xvzf apache-maven-3.3.3-bin.tar.gz
cd apache-maven-3.3.3
sudo rm /usr/bin/mvn 2> /dev/null
sudo alternatives --install /usr/bin/mvn mvn $HOME/apache-maven-3.3.3/bin/mvn 200000
sudo alternatives --config mvn
# Downloading and compiling Spark
printf "\n\n[LOG] Downloading Spark...\n\n"
curl -O http://mirror.nbtelecom.com.br/apache/spark/spark-1.5.0/spark-1.5.0.tgz
tar -zxf spark-1.5.0.tgz
cd spark-1.5.0
printf "\n\n[LOG] Starting Spark installation. Be very, very, very patient.\n\n"
build/mvn -DskipTests clean package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment