Jupyter Notebook, a widely-used open-source application, enables the creation and sharing of documents containing live code, equations, visualizations, and descriptive text. Originating from the IPython project, Jupyter Notebook supports over 40 programming languages, including Python, R, Julia, and Scala.

Installing Jupyter Notebook on Ubuntu allows you to perform data visualization, machine learning, statistical modeling, and other forms of data analysis directly from your browser. The process is straightforward, requiring a few terminal commands to get Jupyter up and running.

For those accustomed to Python development, Jupyter Notebook provides an interactive shell, excellent for real-time data analysis, combining the power of Python libraries with a user-friendly interface.

Steps to install Jupyter Notebook on Ubuntu:

  1. Open your terminal.
  2. Update the system packages.
    $ sudo apt update && sudo apt upgrade -y
  3. Install pip, Python's package manager.
    $ sudo apt install python3-pip
  4. Use pip to install Jupyter Notebook.
    $ pip3 install notebook
  5. Start the Jupyter Notebook server.
    $ jupyter notebook

    This command will start the server and open Jupyter Notebook in your default browser. The terminal will display a URL that you can use to access Jupyter from other devices on your local network.

  6. Secure your Jupyter Notebook with a password.
    $ jupyter notebook password

    Setting a password prevents unauthorized access. After executing this command, you'll be prompted to enter and confirm a password.

  7. (Optional) Set up a systemd service for Jupyter Notebook.

    This step allows Jupyter to run as a background service, starting on boot.

    $ sudo nano /etc/systemd/system/jupyter.service
  8. Inside the opened file, paste the following configuration, adjusting paths as necessary.
            [Unit]
            Description=Jupyter Notebook
     
    [Service]
    Type=simple
    PIDFile=/run/jupyter.pid
    ExecStart=/usr/local/bin/jupyter-notebook --config=/home/your-username/.jupyter/jupyter_notebook_config.py
    User=your-username
    Group=your-groupname
    Restart=always
    RestartSec=10
     
    [Install]
    WantedBy=multi-user.target
  9. Enable and start the Jupyter Notebook service.
    $ sudo systemctl enable jupyter && sudo systemctl start jupyter
  10. Check the status of the Jupyter service.
    $ sudo systemctl status jupyter
  11. Access Jupyter Notebook by navigating to the provided URL in your browser. Typically, it's
    http://localhost:8888/

    If you set a password in a previous step, you'll be prompted to enter it before accessing your notebooks.

Enjoy your Jupyter Notebook experience on Ubuntu!

Discuss the article:

Comment anonymously. Login not required.