Skip to content

Instantly share code, notes, and snippets.

@kgorman
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save kgorman/50f256c1c328efe576b7 to your computer and use it in GitHub Desktop.

Select an option

Save kgorman/50f256c1c328efe576b7 to your computer and use it in GitHub Desktop.
install_jupyterhub
# this script installs jupyter on Rackspace CBD
# 2015 kcg
# the trick here is to install python 3.3 with pip and not ruin the default python install
# then simply run jupyterhub
# this is designed to be run as a postinstall script when provisioning a cluster.
if [ $HOSTNAME == "GATEWAY-1" ]
then
# pre-requisites
curl -sL https://rpm.nodesource.com/setup | bash -
yum --assumeyes groupinstall development
yum --assumeyes install zlib-devel bzip2-devel openssl-devel xz-libs wget git nodejs sqlite-devel
# python 3.3+ and dependencies
wget http://python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xf Python-3.3.5.tar.xz
cd Python-3.3.5
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
cd -
export PATH="/usr/local/bin:$PATH"
# python 2.7 and dependencies
wget http://python.org/ftp/python/2.7.7/Python-2.7.7.tar.xz
tar xf Python-2.7.7.tar.xz
cd Python-2.7.7
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
cd -
# pip
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2
/usr/local/bin/python3.3 setup.py install
/usr/local/bin/python2.7 setup.py install
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | /usr/local/bin/python3.3 -
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | /usr/local/bin/python2.7 -
cd -
pip install six
# open firewall
iptables -I INPUT 1 -i eth0 -p tcp --dport 8000 -j ACCEPT
iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
# install jupyterhub
rmdir jupyter; git clone https://github.com/jupyter/jupyterhub.git
cd jupyterhub
npm install -g bower less jupyter/configurable-http-proxy
pip install -r requirements.txt
pip install .
/usr/local/bin/python2.7 /usr/local/bin/pip install -r requirements.txt
/usr/local/bin/python2.7 /usr/local/bin/pip install py4j
jupyterhub
# todo setup spark context
cd
ipython profile create default
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment