The Jupyter project is a free software, open standards, and web services for interactive computing across all programming languages. It provides:

I was confused by the JupyterHub and TLJH since they can run on a single server with the multiple users feature but after reading The Littlest Jupyterhub by Yuvi

The Littlest JupyterHub serves the long tail of potential JupyterHub users who have the following needs only.

  1. Support a very small number of students (around 20–30, maybe 50)
  2. Run on only one node, either a cheap VPS or a VM on their favorite cloud provider
  3. Provide the same environment for all students
  4. Allow the instructor / admin to easily modify the environment for students with no specialized knowledge
  5. Be extremely low maintenance once set up & easily fixable when it breaks
  6. Allow easy upgrades
  7. Enforce memory / CPU limits for students

TLJH provides a system command called tljh-config to deal with jupyterhub_config.py which is not easy to use by normal users. For more details, see: TLJH: What does the installer do?

Reference:

Install TLJH

Installation is very easy, just need to run:

sudo apt install python3 python3-dev git curl
# change the USERNAME and USERPWD
curl -L https://tljh.jupyter.org/bootstrap.py  | sudo python3 - --admin ${USERNAME}:${USERPWD}

then you can access http://localhost/ via your browser

Install python packages in the user environment

sudo -E pip install <something>

Customize configuration

# change default 8000 port to 9000
sudo tljh-config set http.port 9000
sudo tljh-config reload proxy
# Enable native authenticator, let users sign up
sudo tljh-config set auth.type nativeauthenticator.NativeAuthenticator
sudo tljh-config set auth.NativeAuthenticator.open_signup true
sudo tljh-config reload
# Check configuration
sudo tljh-config show
# Output
# Configure file location: `/opt/tljh/config/config.yaml`
users:
  admin:
  - oopsmonk
http:
  port: 9000
auth:
  type: nativeauthenticator.NativeAuthenticator
  NativeAuthenticator:
    open_signup: true

Reference:

Create an user

http://localhost:9000/hub/signup

Remove an user

  1. delete the user from Hub GUI: http://localhost/hub/admin#/
  2. delete the user from system
# stop the services
sudo systemctl stop jupyter-<username>
# disable the services
sudo systemctl disable jupyter-<username>
# reset the state of all units
sudo systemctl daemon-reload
sudo systemctl reset-failed
# remove user from system
sudo userdel -r jupyter-<username>

Uninstall TLJH

Uninstall steps are depended on the admin’s specific modifications, the way to remove it is undoing steps in What does the installer do? properly.

Here is a simple example:

# stop the services
sudo systemctl stop jupyterhub.service
sudo systemctl stop traefik.service
sudo systemctl stop jupyter-<username>

# disable the services
sudo systemctl disable jupyterhub.service
sudo systemctl disable traefik.service
# run this command for all the Jupyter users
sudo systemctl disable jupyter-<username>

# remove the systemd unit
sudo rm /etc/systemd/system/jupyterhub.service
sudo rm /etc/systemd/system/traefik.service

# reset the state of all units
sudo systemctl daemon-reload
sudo systemctl reset-failed

# unlink configuration command
sudo unlink /usr/bin/tljh-config

# remove tljh data
# $ ls /opt/tljh/
#   config  hub  installer.log  state  user
sudo rm -rf /opt/tljh

# remove all jupyter users in the system
sudo userdel jupyter-<username>

# remove the user groups
sudo delgroup jupyterhub-users
sudo delgroup jupyterhub-admins
# remove jupyterhub-admins from the sudoers group
sudo rm /etc/sudoers.d/jupyterhub-admins