---
title: How to Install Jupyter Notebook on Ubuntu 24.04
url: https://docs.vultr.com/how-to-install-jupyter-notebook-on-ubuntu-24-04
description: Learn how to install Jupyter Notebook on Ubuntu 24.04 with our step-by-step guide. Get your data science environment up and running quickly and easily.
publish_date: 2025-04-16T15:02:28.866568Z
last_updated: 2026-09-09T23:28:46.147389Z
author: Muhammed Ali
header_image: https://docs.vultr.com/public/doc-assets/2148/4d32feca-2afb-4354-96df-d7df8a30b870.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

Jupyter Notebook is a popular open-source web interface that allows used to create and share documents containing live code, visualizations, and narrative text. It's widely used in data science, machine learning, and academic research for its ease of use and interactive capabilities.

This article explains how to install Jupyter Notebook on Ubuntu 24.04. You will configure the Jupyter notebook for remote access and set it up to run automatically as a systemd service on boot.

## Prerequisites

Before you begin, you need to:

* Have access to an [Ubuntu 24.04 instance](https://www.vultr.com/servers/ubuntu) as a [non-root user with `sudo` privileges](https://www.vultr.com/docs/how-to-use-sudo-on-a-vultr-cloud-server/#create-a-sudo-user-on-debian-&-ubuntu).

## Install Jupyter Notebook on Ubuntu 24.04

There are multiple ways to install Jupyter Notebook on Ubuntu 24.04. You can install Jupyter Notebook with methods, including the following.

* Pip.
* APT package manager.
* Anaconda.

???+ note "Install Jupyter Notebook Using Pip"

    This method uses Python’s `pip` package manager to install Jupyter Notebook in an isolated virtual environment. It allows you to manage dependencies without interfering with system packages. Follow the steps below to install Jupyter Notebook using Pip.

    1. Update APT package index..

        ```console
        $ sudo apt update
        ```

    1. Install the `virtualenv` package:

        ```console
        $ sudo apt install python3-virtualenv -y
        ```

    1. Create a new virtual environment named `jupyter_env`.

        ```console
        $ virtualenv jupyter_env
        ```

    1. Activate the virtual environment.

        ```console
        $ source jupyter_env/bin/activate
        ```

    1. Install Jupyter Notebook using `pip`.

        ```console
        $ pip install jupyter
        ```

    1. Verify the installed Jupyter Notebook version.

        ```console
        $ jupyter-notebook --version
        ```

        You can deactivate the virtual environment anytime by running `deactivate`.

??? note "Install Jupyter Notebook Using APT"

    This method installs Jupyter Notebook using Ubuntu's default APT package manager. The version available through APT may be outdated and may not include newer features. If you require the latest tools or extensions, consider using Pip or Anaconda instead. Follow the steps below to install Jupyter Notebook using APT.

    1. Update the package list.

        ```console
        $ sudo apt update
        ```

    1. Install Jupyter Notebook.

        ```console
        $ sudo apt install jupyter-notebook -y
        ```

    1. Verify the installed Jupyter Notebook version.

        ```console
        $ jupyter-notebook --version
        ```

??? note "Install Jupyter Notebook Using Anaconda"

    Anaconda is a popular Python distribution designed for data science and machine learning. It includes Jupyter Notebook along with many pre-installed libraries and tools. This method is ideal if you already use Anaconda or want a complete data science environment out of the box. Follow the steps below to install Jupyter Notebook using Anaconda.

    1. Install [Anaconda](https://docs.vultr.com/how-to-install-anaconda-on-ubuntu-24-04) if it's not installed on your workstation.
    1. Create a new `jupyter_env` Conda environment with Python.

        ```console
        $ conda create -n jupyter_env python=3.10
        ```

        * Press `y` and `ENTER` when prompted to proceed.

            ```
            Proceed ([y]/n)? y
            ```

    1. Activate the `jupyter_env` environment.

        ```console
        $ conda activate jupyter_env
        ```

    1. Install Jupyter Notebook.

        ```console
        $ conda install jupyter notebook
        ```

        * Confirm when prompted.

            ```
            Proceed ([y]/n)? y
            ```

    1. Verify the installed Jupyter Notebook version

        ```console
        $ jupyter-notebook --version
        ```

## Access Jupyter Notebook Locally

To access Jupyter Notebook from your local machine, first configure the application, then establish an SSH tunnel to securely forward the port. Follow the steps below to configure Jupyter Notebook and set up port forwarding to access the application locally.

1. Generate a Jupyter configuration file.

    ```console
    $ jupyter notebook --generate-config
    ```

    The above command generates a configuration file `~/.jupyter/jupyter_notebook_config.py`.

1. Open the configuration file.

    ```console
    $ nano ~/.jupyter/jupyter_notebook_config.py
    ```

1. Add the following configuration below the line `c = get_config() #noqa` to the `jupyter_notebook_config.py`file depending on your installation method.

    * If you installed Jupyter using `pip` or Anaconda, use:

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

        Save and exit (:key_ctrl: + :key_x:, then :key_y:, then hit :key_enter:).

    * If you installed Jupyter using `apt`, use:

        ```python
        c.NotebookApp.open_browser = False  # Prevent it from opening a browser on the server
        c.NotebookApp.allow_remote_access = True  
        ```

1. Launch Jupyter Notebook.

    ```console
    $ jupyter notebook
    ```

    Output:

    ```
    .........................................
    [I 2025-04-02 16:25:34.253 ServerApp] Jupyter Server 2.15.0 is running at:
    [I 2025-04-02 16:25:34.253 ServerApp] http://localhost:8888/tree?token=65e7d4f05956703d40b2d01e1e43fa89da8df82e1824e711
    [I 2025-04-02 16:25:34.253 ServerApp]     http://127.0.0.1:8888/tree?token=65e7d4f05956703d40b2d01e1e43fa89da8df82e1824e711
    [I 2025-04-02 16:25:34.253 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    [C 2025-04-02 16:25:34.256 ServerApp] 
    ```

    Copy the full tokenized URL and paste it into your local browser to access the Jupyter interface. The token provides secure access to the Notebook server without a password.

    ```
    http://127.0.0.1:8888/tree?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ```

1. Run the following command to create an SSH tunnel on your local workstation to forward traffic from the remote server port `8888` to your localhost port `8888`.

    ```console
    $ ssh -M -f -N -L 8888:localhost:8888 linuxuser@<SERVER-IP>
    ```

    Replace `linuxuser` with your sudo username and `<SERVER-IP>` with your server's IP address. Within the above command.

    * `-M`: Enables SSH connection monitoring.
    * `-f`: Runs the command in the background after authentication.
    * `-N`: Prevents remote command execution.
    * `-L 8888:localhost:8888`: Binds local port `8888` to the remote server’s port `8888`.

1. Open Jupyter Notebook using the access token you generated earlier.

    ```
    http://127.0.0.1:8888/tree?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ```

1. Click **New** and select **Python 3 (ipykernel)** to start a new notebook.

    ![create new notebook](https://docs.vultr.com/public/doc-assets/2148/f03928fe-3b71-4164-862d-350cbdfaac59.png)

1. Click **Select** to confirm the Python kernel.

    ![Choose the Python kernel](https://docs.vultr.com/public/doc-assets/2148/95d1ee21-945c-4e14-ac73-c9bdb6e2f53f.png)

1. Test the Notebook by typing a simple arithmetic operation (like 100 + 20) and press :key_shift: + :key_enter: to run the cell.

    ![test notebook](https://docs.vultr.com/public/doc-assets/2148/8f630df2-1baa-4e00-add4-97c79564165f.png)

    > [!NOTE]  
    > This article uses SSH tunneling, which doesn’t require opening ports. However, if you plan to expose Jupyter directly without tunneling, run the `jupyter notebook --ip=0.0.0.0` command open and manually allow the port using the `sudo ufw allow 8888/tcp` command.

## Create a Jupyter Notebook System Service

You can configure Jupyter Notebook to launch automatically on system startup using a `systemd` service. The setup differs slightly based on how you installed Jupyter. Follow the steps below to set up a new Jupyter Notebook system service to automatically start it at boot.

1. Create a new `jupyter.service` system service file using `nano`.

    ```console
    $ sudo nano /etc/systemd/system/jupyter.service
    ```

1. Add the appropriate configurations to the file depending on your installation method. Replace `linuxuser` with your actual sudo user and adjust any paths as needed.

    * For pip (virtual environment) installation.

        ```ini
        [Unit]
        Description=Jupyter notebook (pip Virtual Environment)
        After=network.target

        [Service]
        Type=simple
        User=linuxuser
        Group=linuxuser
        WorkingDirectory=/home/linuxuser
        ExecStart=/home/linuxuser/jupyter_env/bin/python -m jupyter notebook
        Restart=always
        RestartSec=10

        [Install]
        WantedBy=multi-user.target
        ```

    * For Anaconda installation.

        ```ini
        [Unit]
        Description=Jupyter Notebook (Anaconda Installation)
        After=network.target
        
        [Service]
        Type=simple
        User=linuxuser
        Group=linuxuser
        WorkingDirectory=/home/linuxuser
        ExecStart=/bin/bash -c ". /home/linuxuser/anaconda3/etc/profile.d/conda.sh && conda activate jupyter_env && exec jupyter-notebook --config=/home/linuxuser/.jupyter/jupyter_notebook_config.py"
        Restart=always
        RestartSec=10
        
        [Install]
        WantedBy=multi-user.target
        ```

    * For APT-based installation.

        ```ini
        [Unit]
        Description=Jupyter Notebook (apt Installation)
        After=network.target

        [Service]
        Type=simple
        User=linuxuser
        Group=linuxuser
        WorkingDirectory=/home/linuxuser
        ExecStart=/usr/bin/jupyter-notebook --config=/home/linuxuser/.jupyter/jupyter_notebook_config.py
        Restart=always
        RestartSec=10

        [Install]
        WantedBy=multi-user.target
        ```

        Save and close the file.

1. Reload `systemd` to apply the new service changes.

    ```console
    $ sudo systemctl daemon-reload
    ```

1. Enable the service so it runs at boot.

    ```console
    $ sudo systemctl enable jupyter
    ```

1. Start the Jupyter Notebook service.

    ```console
    $ sudo systemctl start jupyter
    ```

1. Check the service status and verify that it's running.

    ```console
    $ sudo systemctl status jupyter
    ```

    Your output should be similar to the one below.

    ```
    ● jupyter.service - Jupyter notebook (pip Virtual Environment)
        Loaded: loaded (/etc/systemd/system/jupyter.service; enabled; preset: enab>
        Active: active (running) since Thu 2025-04-03 11:32:11 UTC; 8s ago
    Main PID: 9961 (jupyter-notebook)
        Tasks: 1 (limit: 1057)
        Memory: 64.5M (peak: 64.7M)
            CPU: 1.791s
        CGroup: /system.slice/jupyter.service
                └─9961 /home/linuxuser/jupyter_env/bin/python /home/linuxuser/jupyte>
    ```

    If you run Jupyter as `root`, it can create files that are only accessible by root. If the systemd service fails to start or throws permission errors, check the ownership of these files and change them back to your non-root sudo user.

## Conclusion

You have installed Jupyter Notebook on Ubuntu 24.04 using three different methods: pip, APT, and Anaconda. Each method serves a different use case, so you can choose the one that best fits your workflow. You also configured Jupyter Notebook for local browser access using SSH port forwarding and set it up to run on boot with a `systemd` service. Use pip if you want a lightweight, isolated environment, APT for system-managed installations, and Anaconda if you're working with data science tools out of the box.
