How to Install Littlest JupyterHub (TLJH) on Deben 11/12 and Ubuntu 20.04 LTS/22.04 LTS

H
Littlest Jupyter Hub (TLJH) is a Jupyter Hub distribution. The main goal of this project is to make it easier to set up Jupyter Hub for a small number of users (maximum 100 users) on the same server. TLJH allows users to use Jupyter Lab in their own isolated environment.

In this article, we will show you how to install The Littlest Jupyter Hub (TLJH) on Debian 11, Debian 12, Ubuntu 20.04 LTS and Ubuntu 22.04 LTS operating systems. We'll also show you how to access Jupyter Hub, how to create new TLJH users, and how to manage TLJH user sessions. We will show you how to install the new Python library for all TLJH users.

Contents:

  1. Installing dependency packages for TLJH
  2. Installing the Smallest Jupyter Hub (TLJH)
  3. Checking if TLJH is working
  4. Access to TLJH
  5. Creating TLJH Users and Managing TLJH User Sessions
  6. Installing Python libraries for all Jupyter Hub users
  7. conclusion
  8. Reference

Installing dependency packages for TLJH

First, update the APT package database cache with the following command:

To install required dependency packages for Jupyter Hub, run the following command:

, sudo apart to install Python3 Python3-dev Python3-pip git curl

To confirm the installation, press “Y” and then press <दर्ज करें>,

Dependency packages are being downloaded. It takes some time to complete.

Dependency packages are being downloaded. It takes some time to complete.

At this point the dependency packages should be installed on your Ubuntu/Debian machine.

Installing the Smallest Jupyter Hub (TLJH)

Before installing TLJH on your Ubuntu/Debian machine, you need to find the username of the user you want to configure as TLJH administrator. Typically, you would configure your Ubuntu/Debian machine's login user as TLJH Administrator, unless you have something else in mind. You can configure any user as TLJH administrator depending on your needs.

You can find the username of your login user by the following command:

In our case, the login username is “shown”.

To install TLJH on your Ubuntu/Debian machine, run the following command:

, curl -l https:,tljh.jupyter.org,bootstrap.py , sudo -I Python3 – –administrator ,,Who am I,

Comment: We are configuring our login user as TLJH administrator. If you want to configure another user as a TLJH administrator, replace –admin $(whoami) with –admin in the previous command.

TLJH is being installed on your Ubuntu/Debian machine. It takes some time to download and install all TLJH components.

At this point, TLJH should be installed on your Ubuntu/Debian machine.

Checking if TLJH is working

To verify that TLJH is working on your computer, first check if TLJH proxy service traffic is working with the following command:

, sudo systemctl status traefik.service

As you can see, the Traffic Proxy service is running and is configured to start automatically at system boot.

Also check if JupyterHub service is working with the following command:

, sudo systemctl status jupyterhub.service

As you can see, the JupyterHub service is also running and is configured to start automatically on system boot.

Since the Traffic Proxy and JupyterHub “systemd” services are running correctly, The Littlest Jupyter Hub (TLJH) is working fine.

Access to TLJH

To access TLJH from a web browser, you need to know the IP address (or DNS name if configured) of your Ubuntu/Debian machine. In our case, the IP address is 192.168.189.128. This may be different for you. So, make sure to change it with yourself from now on.

Open a web browser app and go And you will see the JupyterHub login page.

Type in your administrator username, your desired login password (which you want to set for JupyterHub's administrator user), and click “Sign In.”

You must be logged in to JupyterHub.

Creating TLJH Users and Managing TLJH User Sessions

To create a new TLJH user, log in to JupyterHub as an administrator user and click File > Hub Control Panel.

Click on “Admin”.

All TLJH users and user sessions/hubs should be listed.

Click “Add User”.

Type the username you want to add to TLJH[1], You can add one user or multiple users to TLJH at once. To add multiple users to TLJH, type each username on a separate line.

If you want newly created users to have administrative access to TLJH, tick “Admin”[2],

Once you're done, click “Add User”[3],

New TLJH users must be created[1],

From the “Admin” page, you can manage (start/stop) TLJH user sessions/hub for each user[2] and all users[3],

To log in as one of the TLJH users, type the username and password you want to set for the new user and click “Sign In.”

Comment: The password you use to log in for the first time will be set as the login password for the new user.

You must be logged in to JupyterHub as a new user.

The TLJH admin user can view users who are logged in to TLJH and manage user sessions/hubs.

Installing Python libraries for all Jupyter Hub users

Every TLJH user can install any Python library with the Python pip from their Jupyter Hub session. But to save disk space, you can install the most commonly used Python libraries system-wide so that all Jupyter Hub users can access them without the need to reinstall them.

First, log in to TLJH as the administrator user and click on “Terminal” from the “Launcher” tab.

To install (assume) the matplotlib Python library for all TLJH users, run the following command:

, sudo -I pip3 to install matplotlib

Installing Matplotlib. It takes some time to complete.

At this point, the matplotlib Python library should be installed for all TLJH users.

To test if other TLJH users can use the matplotlib Python library, login as one of the TLJH users, create a new Jupyter notebook, and run the following lines of code (which we copied from the matplotlib documentation ):

import matplotlib.pyplot As Plateau
plt.plot,[1, 2, 3, 4],
plt.ylabel,'some numbers',
plt.show,,

If the TLJH user can access matplotlib, the code should generate a graph as shown in the following screenshot:

conclusion

In this article, we showed you how to install The Littlest Jupyter Hub (TLJH) on Debian 11, Debian 12, Ubuntu 20.04 LTS and Ubuntu 22.04 LTS operating systems. We also showed you how to access TLJH from a web browser, how to create new TLJH users, and how to manage TLJH user sessions. We showed you how to install the new Python library for all TLJH users.

Reference:

Add comment

By Ranjan