Last active
March 13, 2019 20:36
-
-
Save pacuna/1510b04d09c86dadf7345204e05456d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd /tmp | |
apt-get update | |
export ANACONDA_LOCATION="anaconda3" | |
export ANACONDA_FILE="Anaconda3-5.3.1-Linux-x86_64.sh" | |
export ANACONDA_URL="https://repo.anaconda.com/archive/" | |
export ANACONDA_HOME=/usr/$ANACONDA_LOCATION | |
echo "ANACONDA_HOME=\"${ANACONDA_HOME}\"" >> /etc/environment | |
export ANACONDA_SHA256=d4c4256a8f46173b675dd6a62d12f566ed3487f932bab6bb7058f06c124bcc27 | |
# Get the SHA256 from https://docs.anaconda.com/anaconda/install/hashes/lin-2-64 | |
# install anaconda with SHA check (This is important) | |
apt-get install wget unzip bzip2 -y \ | |
&& wget -c -O "$ANACONDA_FILE" --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "$ANACONDA_URL$ANACONDA_FILE" \ | |
&& echo "$ANACONDA_SHA256 $ANACONDA_FILE" | sha256sum -c - \ | |
&& bash $ANACONDA_FILE -b -p $ANACONDA_HOME -f | |
#&& rm -f $ANACONDA_FILE | |
# Fix so that users can find this first (Users get PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/spark/.local/bin:/home/spark/bin) | |
# So the link in /usr/local/bin gets found before /bin or /usr/bin | |
# root does not have /usr/local/bin so yum keeps working for it | |
ln -sf $ANACONDA_HOME/bin/python /usr/local/bin/python | |
. /usr/anaconda3/etc/profile.d/conda.sh | |
conda create --yes -n python36 python=3.6 anaconda | |
conda activate python36 | |
# Install sparkmagic kernels for jupyter | |
apt-get install gcc libkrb5-dev -y | |
pip install --user sparkmagic psycopg2 | |
cd $($ANACONDA_HOME/bin/pip show sparkmagic | grep Location | cut -f2 -d":") | |
jupyter-kernelspec install --user sparkmagic/kernels/sparkkernel | |
jupyter-kernelspec install --user sparkmagic/kernels/pysparkkernel | |
jupyter-kernelspec install --user sparkmagic/kernels/pyspark3kernel | |
jupyter-kernelspec install --user sparkmagic/kernels/sparkrkernel | |
jupyter nbextension enable --py --sys-prefix widgetsnbextension | |
echo ". /usr/anaconda3/etc/profile.d/conda.sh" >> /home/dev/.bashrc | |
echo "conda activate python36" >> /home/dev/.bashrc | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment