Install Jupyter notebook on Ubuntu 24.04 and allow remote access.

August 12, 2025 27hotness 0likes 0comments

References:

Vultr

How to Install Jupyter Notebook on Ubuntu 24.04

https://docs.vultr.com/how-to-install-jupyter-notebook-on-ubuntu-24-04

Prerequisites

  • Ubuntu 24.04
  • Internet

Using pip Install Jupyter Notebook on Ubuntu 24.04

  1. Update APT package index.. sudo apt update

  2. Install the virtualenv package: sudo apt install python3-virtualenv -y

  3. Create a new virtual environment named jupyter_env. virtualenv jupyter_env

  4. Activate the virtual environment. source jupyter_env/bin/activate

  5. Install Jupyter Notebook using pip. pip install jupyter

6.Verify the installed Jupyter Notebook version. jupyter-notebook --version

You can deactivate the virtual environment anytime by running deactivate

If u need more gudelines please visit Vultr

Config file modify


1. Basically modify 

vim ~/.jupyter_notebook_config.py

c.ServerApp.open_browser = False  \# Prevent it from opening a browser on the server
c.ServerApp.allow_remote_access = True  \# Allow external access

2. Set password

jupyter notebook password #reminder u enter the password

cat  ~/.jupyter_server_config.json \# copy the password hash

vim ~/.jupyter_notebook_config.py 

\#modify option
c.ServerApp.password = '___your password hash___'

3. Write a shell script to allow remote access.

\#!/bin/bash
source __yourenvname__/bin/activate

CURRENT_IP=$(hostname -I | awk '{print $1}')
echo "IP Address: $CURRENT_IP"

jupyter notebook --no-browser --port 8888 --ip="CURRENT_IP"

小四

喜欢摄影 和IT

Comments