Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Start a new instance on the LRZ Compute Cloud where the number of cores should be the number of participants of the course. In general 20 cores should be fine.
  • Choose Ubuntu for the OS.
  • You need a private/public key for login from your terminal/desktop
  • Add the Port 8000 in a Security Group of the VM
  • Generate a floating IP for the respective provider network your VM is connected to  (either MWN or internet) and attach it to the VM.
  • You have to use this floating IP when you later on connect to the jupyter server. http://<floating-ip>:8000
  • Be aware that the system is accessible from the whole internet and can be an aim for hackers. Monitor the machine periodically and shelve it when it is not in use!
  • Also see: Security Basics from the jupyterhub documentation
  • You can use the LRZ GitLab Server for authentication (see below for the setup)

Installation of the software

  • Do not change the root password. By doing that root cannot be attacked from the outside
  • Use sudo for installation of the software
  • Download miniconda from conda as root and install it


Code Block
languagebash
titlebash history
linenumberstrue
# first: login to the VM as ubuntu user
# now become root and install the software 

$ sudo su

#$ makeapt anupdate
$ installation folder for theapt install jupyter installation
#$ getapt minicoda from the anaconda web site and extract it

$ mkdir /opt/miniconda3
$ chmod 770 -R /opt/miniconda3
$ cd /opt/miniconda3
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ chmod +x ./Miniconda3-latest-Linux-x86_64.sh
$ ./Miniconda3-latest-Linux-x86_64.sh
# as installation directory chose /opt/miniconda3

# activate your installation and install jupyterhub
$ source /opt/miniconda3/bin/activate
$ conda install jupyterhub

# start jupyterhub server
$ jupyterhub
install python3-pip
$ python3 -m pip install jupyterhub
$ apt install npm
$ npm install -g configurable-http-proxy
$ useradd -m testuser
$ passwd testuser
$ jupyterhub 


Additional Information for the Installation

...

Code Block
languagebash
titlebash history
linenumberstrue
$ python
>>> import os
# create 20 users (user0, user1, .., user19)
>>> [os.system(f"useradd -m user{i}") for i in range(20)]
>>> [os.system(f"echo user{i}:NEW_SECRET_PASSWORD | chpasswd") for i in range(20)]
# create an admin0 user
>>> os.system(f"useradd -m admin0")
>>> os.system(f"echo admin0:NEW_SECRET_PASSWORD | chpasswd")
# create a folder for course material for each user which is owned by admin0
>>> os.system("mkdir /home/admin0/course_material")
>>> [os.system(f"ln -s /home/admin0/course_material /home/user{i}/course_material1") for i in range(101)]

Authentication via OAuth on GitLab

You can use the LRZ GitLab server for the authentication on the JupyterHub server. The user has to configure the application in his profile:

(https://docs.gitlab.com/ee/integration/oauth_provider.html, "Adding an application through the profile"

This only works for applications without root access. Then follow the JupyterHub/GitLab documentation to install the JupyterHub plugin:

https://github.com/jupyterhub/oauthenticator
https://oauthenticator.readthedocs.io/en/latest/getting-started.html#gitlab-setup

...