Jupyter Notebook is an interactive web-based computing environment for Python. It is widely used in data science, machine learning, and scientific research. This guide installs Jupyter Notebook on Ubuntu 24.04 LTS and configures it for remote access.
Tested and valid on:
- Ubuntu 24.04 LTS
Prerequisites
- Ubuntu 24.04 LTS server
- Python 3.12 installed
- A user account
Step 1 – Create a Virtual Environment
Install Jupyter in an isolated environment:
python3.12 -m venv ~/jupyter_env
source ~/jupyter_env/bin/activate
Step 2 – Install Jupyter Notebook
Install with pip:
pip install notebook
Step 3 – Generate a Configuration File
Create the Jupyter config:
jupyter notebook --generate-config
Step 4 – Set a Password
Create a hashed password for Jupyter:
jupyter notebook password
Enter and confirm a strong password at the prompts.
Step 5 – Configure for Remote Access
Edit the config file:
nano ~/.jupyter/jupyter_notebook_config.py
Set:
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
Step 6 – Start Jupyter Notebook
Launch the server:
jupyter notebook
Access at http://your_server_ip:8888.
Step 7 – Run Jupyter as a systemd Service
Create a service file:
sudo nano /etc/systemd/system/jupyter.service
Add:
[Unit]
Description=Jupyter Notebook Server
[Service]
Type=simple
User=ubuntu
ExecStart=/home/ubuntu/jupyter_env/bin/jupyter notebook
WorkingDirectory=/home/ubuntu
Restart=always
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl enable jupyter
sudo systemctl start jupyter
Conclusion
Jupyter Notebook is now running on Ubuntu 24.04 LTS. For JupyterLab (the next-generation interface), install it with pip install jupyterlab and start with jupyter lab.