Skip to content

Instantly share code, notes, and snippets.

@snapo
Last active December 4, 2018 23:33
Show Gist options
  • Save snapo/15bd979ce5347b04b76db7f47bd05767 to your computer and use it in GitHub Desktop.
Save snapo/15bd979ce5347b04b76db7f47bd05767 to your computer and use it in GitHub Desktop.
apt-get -y update && apt-get -y upgrade
wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
bash Anaconda3-5.3.1-Linux-x86_64.sh
apt-get -y install python3-pip gcc g++
apt-get -y install npm nodejs
npm install -g configurable-http-proxy
pip3 install setuptools
pip3 install wheel
pip3 install --upgrade pip wheel
apt-get install python3.6-dev libevent-dev
pip install pip --upgrade
pip install setuptools --upgrade
pip3 install pip --upgrade
pip3 install setuptools --upgrade
export PATH="${HOME}/.local/bin:$PATH"
apt-get -y install gcc-6 g++-6
pip3 install jupyterhub
pip3 install --upgrade notebook
pip3 install oauthenticator
adduser snapo # same as my github username
mkdir /home/snapo/notebooks
chown snapo:snapo /home/snapo/notebooks
#### Go to https://github.com/settings/applications/new and create a new app key for authentication
### open with nano or something else nano jupyterhub_config.py
#### replace all text with: #####
#--------------------------------------------------------------------------------------------------------------------------$
# Application configuration
#--------------------------------------------------------------------------------------------------------------------------$
# This is an application.
c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
c.GitHubOAuthenticator.oauth_callback_url = 'https://hub.jans.li/hub/oauth_callback'
c.GitHubOAuthenticator.client_id = '---­­­­­­­Some cryptic string----­­­­­'
c.GitHubOAuthenticator.client_secret = '---­­­­­­­Some cryptic string----­­­­­'
# This is an application.
# create system users that don't exist yet
c.LocalAuthenticator.create_system_users = True
c.Authenticator.whitelist = {'snapo'}
c.Authenticator.admin_users = {'snapo'}
c.Spawner.notebook_dir = '~/notebooks'
c.JupyterHub.cookie_secret_file = '/home/ubuntu/jupyterhub_cookie_secret'
c.JupyterHub.proxy_cmd = ['/usr/local/bin/configurable-http-proxy']
nano /etc/systemd/system/jupyterhub.service
### add this content with your username where you started the config ######
[Unit]
Description=Jupyterhub
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/anaconda3/bin"
ExecStart=/usr/local/bin/jupyterhub -f /home/ubuntu/jupyterhub_config.py
[Install]
WantedBy=multi-user.target
#############
systemctl daemon-reload
systemctl enable jupyterhub.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment