Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Julia on Azure HDInsight
#!/usr/bin/env bash
# install julia
curl -s https://julialang.s3.amazonaws.com/bin/linux/x64/0.5/julia-0.5.1-linux-x86_64.tar.gz | sudo tar -xz -C /usr/local/
JULIA_HOME=/usr/local/julia-6445c82d00
# install maven
curl -s http://mirror.olnevhost.net/pub/apache/maven/binaries/apache-maven-3.2.2-bin.tar.gz | sudo tar -xz -C /usr/local/
export M2_HOME=/usr/local/apache-maven-3.2.2
export PATH=$M2_HOME/bin:$PATH
# Create Directories
export JULIA_PKGDIR="/home/hadoop/.julia/"
mkdir "/home/hadoop"
mkdir ${JULIA_PKGDIR}
mkdir "${JULIA_PKGDIR}v0.5"
# Set Environment variables for current session
export PATH=${PATH}:${MVN_HOME}/bin:${JULIA_HOME}/bin
export HOME="/root"
echo "Installing Julia Packages in Julia Folder ${JULIA_PKGDIR}"
#Install Spark.jl
$JULIA_HOME/bin/julia -e 'Pkg.init();Pkg.clone("https://github.com/aviks/Spark.jl");Pkg.checkout("Spark", "as/fixinit"); Pkg.build("Spark")'
# Install IJulia
$JULIA_HOME/bin/julia -e 'Pkg.add("IJulia")'
declare -a users=("spark" "yarn" "hadoop" "jlssh01") #TODO: change accordingly
for cusr in "${users[@]}"; do
echo " Adding vars for ser ${cusr}"
echo "" >> /home/${cusr}/.bashrc
echo "export MVN_HOME=/usr/local/apache-maven-3.2.2" >> /home/${cusr}/.bashrc
echo "export PATH=${PATH}:${MVN_HOME}/bin:${JULIA_HOME}/bin" >> /home/${cusr}/.bashrc
echo "export YARN_CONF_DIR=/etc/hadoop/conf" >> /home/${cusr}/.bashrc
echo "export JULIA_PKGDIR=${JULIA_PKGDIR}" >> /home/${cusr}/.bashrc
echo "source ${SPARK_HOME}/bin/load-spark-env.sh" >> /home/${cusr}/.bashrc
# Set Package folder permissions
setfacl -R -m u:${cusr}:rwx ${JULIA_PKGDIR};
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment