In this article, we will show you how to install the latest version of JupyterHub on the following Linux distributions:
- Ubuntu 22.04 LTS
- debian 12
- linux mint 21
You can also install JupyterHub on other Ubuntu/Debian-based Linux distributions. The same processes should work with little or no changes.
- Installing required dependency packages
- Upgrading Python PIP to latest version
- Creating a Python virtual environment for JupyterHub
- Installing Configurable HTTP Proxy
- Installing JupyterHub
- Creating JupyterHub configuration file and systemd service
- Accessing JupyterHub
- Creating new JupyterHub users
- Configure FirstUseAuthenticator on JupyterHub
- Configure IDLE Culler on JupyterHub
- Adding a new programming language support to JupyterHub
Installing required dependency packages
First, update the APT package database cache with the following command:
To install all required dependency packages for JupyterHub, run the following command:
, sudo apart to install Python3-pip Python3-dev Python3-venv nodejs npm git curl
To confirm the installation, press “Y” and then press <दर्ज करें>,
Required dependency packages are being downloaded from the internet. It takes some time to complete.
Required dependency packages are being installed. It takes some time to complete.
At this point, the required dependency packages for JupyterHub should be installed.
To confirm that Python 3, Python 3 PIP, Node.js, and NPM are installed on your computer, run the following commands:
$ pip3 –version
$ npm –version
As you can see, we have Python 3.10.12, Python PIP 22.0.2, Node.js 12.22.9 and NPM 8.5.1 installed on our computer.
Upgrading Python PIP to latest version
Before you install JupyterHub on your computer, you should upgrade your computer's Python PIP to the latest version.
To upgrade Python pip, run the following command:
, sudo pip3 to install –upgrade pip
You must have the latest version of Python PIP installed on your computer.
As you can see, in our case Python PIP has been upgraded from version 22.0.2 to 23.3.1.
Creating a Python virtual environment for JupyterHub
It is recommended to install JupyterHub in a Python virtual environment so that it does not interfere with other Python packages installed from your Linux distribution's official package repository.
To create a new Python virtual environment for JupyterHub in the “/opt/jupyterhub” directory path, run the following command:
, sudo Python3 -M venv ,choose,jupyterhub
Installing Configurable HTTP Proxy
JupyterHub requires a configurable HTTP proxy to work. You can install the Node.js package Configurable HTTP Proxy with the following command:
, sudo npm to install -Yes configurable-http-proxy
Configurable HTTP proxy is being set up. It takes a few seconds to complete.
At this point the configurable HTTP proxy should be installed.
To install required dependencies on JupyterHub and the newly created “/opt/jupyterhub” Python virtual environment, run the following commands:
, sudo ,choose,jupyterhub,bin,Python3 -M pip to install wheel ipywidgets jupyterlab jupyterhub
Installing JupyterHub. It takes some time to complete.
At this point JupyterHub should be installed.
Creating JupyterHub configuration file and systemd service
To create the directories required to store the JupyterHub configuration file and the systemd service file, run the following commands:
, sudo mkdir -P.V ,choose,jupyterhub,etc,,jupyterhub, systemd,
“/opt/jupyterhub/etc/jupyterhub” and “/opt/jupyterhub/etc/systemd” directories should be created.
To create a new JupyterHub configuration file that is “jupyterhub_config.py” in the “/opt/jupyterhub/etc/jupyterhub” directory and open it with the Nano text editor, run the following command:
, sudo nano ,choose,jupyterhub,etc,jupyterhub,jupyterhub_config.py
To access JupyterHub from your network, you need to write the following lines in your “jupyterhub_config.py” file:
# Configure Jupyter Hub access IP and port
Once you're done, save the JupyterHub configuration file.
To create a new JupyterHub “systemd” service file that is “jupyterhub.service” (so that JupyterHub can be started automatically on system boot) in the “/opt/jupyterhub/etc/systemd” directory and copy it into the nano text editor. Open with , run the following command:
, sudo nano ,choose,jupyterhub,etc,systemd,jupyterhub.service
Type the following lines in the “jupyterhub.service” file:
ExecStart,,choose,jupyterhub,bin,jupyterhub –config ,choose,jupyterhub,etc,jupyterhub,jupyterhub_config.py
Once you're done, save the JupyterHub “systemd” service file.
Systemd reads service files from the “/etc/systemd/system” directory. So, create a symbolic link to the JupyterHub “systemd” service file in the “/etc/systemd/system” directory with the following command:
, sudo L.N -S ,choose,jupyterhub,etc,systemd,jupyterhub.service ,etc,systemd,System,jupyterhub.service
To reload the “systemd” service database, run the following command:
, sudo systemctl daemon-reload
Now, add the JupyterHub “systemd” service to your computer's system startup with the following command (so that it automatically starts on system boot):
, sudo systemctl Able jupyterhub.service
To start the JupyterHub service, run the following command:
, sudo systemctl start jupyterhub.service
To check if the JupyterHub service is running, run the following command:
, sudo systemctl status jupyterhub.service
As you can see, JupyterHub service is running And it has been added to my computer's system startup,
To access JupyterHub from a web browser, you need to know the IP address of your computer where you installed JupyterHub.
To find your computer's IP address, run the following command:
The IP address of my computer is 192.168.189.128. This will be different for you. So, make sure to change it with yourself from now on.
You will soon see the JupyterHub login page. By default, JupyterHub is configured to work with users from your Linux system. So, you can log in to JupyterHub with the login username and password of any of your Linux system users.
To log in to JupyterHub, type the username and password of the Linux system user you want to log in to and click “Sign In.”
You must be logged in to your JupyterHub account.
Creating new JupyterHub users
Since JupyterHub works with Linux system users by default, if you want to create a new JupyterHub user, you will need to create a new Linux user.
If you need any help creating a new JupyterHub user, read this article.
Configure FirstUseAuthenticator on JupyterHub
JupyterHub also supports other authentication mechanisms. If you want to create JupyterHub users immediately and set a login password for JupyterHub users when they log in to JupyterHub for the first time, you can configure FirstUseAuthenticator on JupyterHub. As the name suggests, FirstUseAuthenticator lets you create a JupyterHub user when you log in to JupyterHub for the first time.
Configure IDLE Culler on JupyterHub
If you plan to allow a lot of users to use JupyterHub, we recommend you configure the JupyterHub IDLE caller on JupyterHub. JupyterHub IDLE Kaler detects user sessions that have been inactive for a long time and pauses them to save system resources so that other active users can use those resources.
Adding a new programming language support to JupyterHub
In addition to Python, you can add support for new programming languages on JupyterHub notebooks. All you need to do is install the JupyterHub kernel for the programming language you want to add to JupyterHub.
If you need any help on adding new programming language support to JupyterHub, read one of the following articles:
In this article, we showed you how to install JupyterHub on Ubuntu 22.04 LTS, Debian 12, Linux Mint 21, and other Ubuntu/Debian-based Linux distributions. We also showed you how to access JupyterHub from a web browser.