---
title: "Easily Install Jupyter Notebook on Ubuntu (Step by Step)"
description: "Take coding to the next level and learn to install Jupyter Notebook on Ubuntu (now JuypterLab) with this tutorial from ATA Learning!"
canonical: "https://adamtheautomator.com/install-jupyter-notebook-on-ubuntu/"
---

# Easily Install Jupyter Notebook on Ubuntu (Step by Step)

> Take coding to the next level and learn to install Jupyter Notebook on Ubuntu (now JuypterLab) with this tutorial from ATA Learning!

Source: https://adamtheautomator.com/install-jupyter-notebook-on-ubuntu/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Easily Install Jupyter Notebook on Ubuntu (Step by Step)](https://adamtheautomator.com/wp-content/uploads/2022/05/Install-Jupyter-Notebook-on-Ubuntu-Now-JupyterLab.jpg)

# Easily Install Jupyter Notebook on Ubuntu (Step by Step)

[![](https://secure.gravatar.com/avatar/2788bb1a3f735603f81eca51d68daec56a9d97e805a10268fb2c20afcc76b81b?s=192&d=mm&r=g)Nicholas Xuan Nguyen](https://adamtheautomator.com/author/nicholas-xuan-nguyen/)20 May 20229 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Python](/tag/python/)[Ubuntu Linux](/tag/ubuntu-linux/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Setting up Anaconda Environments for JupyterLab](#setting-up-anaconda-environments-for-jupyterlab)
*   [Creating a Password for JupyterLab](#creating-a-password-for-jupyterlab)
*   [Securing the JupyterLab Server With Let’s Encrypt SSL](#securing-the-jupyterlab-server-with-lets-encrypt-ssl)
*   [Configuring the JupyterLab Server](#configuring-the-jupyterlab-server)
*   [Starting the JupyterLab Server](#starting-the-jupyterlab-server)
*   [Conclusion](#conclusion)

Are you looking for a UI that eases up performing your data science and AI tasks? If so, then install Jupyter Notebook on Ubuntu (now JupyterLab) and explore the features that make JupyterLab stand out.

In this tutorial, you’ll learn how to install Jupyter Notebook on Ubuntu 20.04 server with secure access via SSL/TLS encryption.

Ready? Read on and start interactive computing with JupyterLab!

## **Prerequisites**

This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have the following.

*   An [Ubuntu](https://adamtheautomator.com/install-ubuntu/) machine – This tutorial uses Ubuntu 20.04.

Related:[How to Install Ubuntu 20.04 \[Step-by-Step\]](https://adamtheautomator.com/install-ubuntu/)

*   A non-root user with [sudo](https://phoenixnap.com/kb/how-to-create-sudo-user-on-ubuntu) privileges.
    
*   [Python 3 installed](https://adamtheautomator.com/install-python-36/) on your machine.
    
*   A registered domain name (your\_domain.com) [pointed](https://www.hostinger.com/tutorials/dns/how-to-point-domain-to-vps) at your server’s public IP address.
    
*   JupyterLab requires a minimum of 4GB RAM to function properly.
    

## Setting up Anaconda Environments for JupyterLab

Before you install Jupyter Notebook on Ubuntu, you need to install Anaconda and configure the environments for JupyterLab. Why? Anaconda is a Python distribution that makes it easy to install, run, and update multiple versions of Python and data science tools like JupyterLab.

With Anaconda, you can create separate environments for each project you work on. This setup keeps your projects organized and prevents one project from breaking another when you upgrade or change dependencies.

To install Jupyter Notebook on Ubuntu, we need to set up Anaconda environments for JupyterLab:

1\. SSH to your server, open your terminal and run the following [apt update](https://linuxize.com/post/how-to-use-apt-command/#updating-package-index-apt-update) and [apt install](https://linuxize.com/post/how-to-use-apt-command/#installing-packages-apt-install) command.

This command updates your server’s package index and installs the dependencies required to add new repositories over HTTPS.

```bash
sudo apt update -y && sudo apt install curl gnupg2 ca-certificates lsb-release -y
```

![Install Jupyter Notebook on Ubuntu  by Updating Server’s Package Index and Install the Required Dependencies](https://adamtheautomator.com/wp-content/uploads/2022/05/image-70.png)

Install Jupyter Notebook on Ubuntu by Updating Server’s Package Index and Install the Required Dependencies

Related:[Getting Started using SSH with PowerShell](https://adamtheautomator.com/powershell-ssh/)

2\. Open your web browser and navigate to the Anaconda [downloads](https://www.anaconda.com/download) page. Scroll down to the bottom and choose the Linux installer for Python 3, as shown below.

Note down the installer’s name as you’ll need it in the following step, but don’t start the download. At this time, the latest Linux 64-bit installer is called _Anaconda3-2021.11-Linux-x86\_64.s_h_._

![Selecting Anaconda Linux 64-bit Hashes](https://adamtheautomator.com/wp-content/uploads/2022/05/image-71.png)

Selecting Anaconda Linux 64-bit Hashes

3\. Now, run the below command to download the Anaconda installation Bash script and save it to the _tmp_ directory. Be sure to replace the URL with the actual path to the latest version of Anaconda you noted in step three.

The Anaconda bootstrap script installer is the fastest way to get the latest Anaconda installer.

```bash
cd /tmp && curl https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh --output anaconda.sh
```

![Downloading the Anaconda Installation Bash Script](https://adamtheautomator.com/wp-content/uploads/2022/05/image-72.png)

Downloading the Anaconda Installation Bash Script

4\. Run the sha256sum command below to generate the SHA-256 checksum of the downloaded file. Replace the path (/tmp/anaconda.sh) with the actual path on your server where you saved the installer.

This command verifies the data integrity of the installer with cryptographic hashes. Doing so ensures the downloaded file has not been tampered with and is exactly what was intended to be downloaded.

```bash
sha256sum /tmp/anaconda.sh
```

Note down the generated checksum to compare it with the sha256 checksum in the Anaconda package’s hashes (step six).

![Verifying the Installer’s Integrity](https://adamtheautomator.com/wp-content/uploads/2022/05/image-73.png)

Verifying the Installer’s Integrity

5\. Next, navigate to the Anaconda [hashes](https://docs.anaconda.com/anaconda/install/hashes/lin-3-64/) page on your browser.

Compare the generated checksum you noted in step five with the one listed in the sha256 checksum. If they match, you can proceed with installing Anaconda.

![Comparing Hashes](https://adamtheautomator.com/wp-content/uploads/2022/05/image-74.png)

Comparing Hashes

6\. Execute the [anaconda.sh](https://www.anaconda.com/) script to install Anaconda on your server.

```bash
bash anaconda.sh
```

Type yes at the prompt to access the license terms agreement.

![Accepting the Terms of License Agreement](https://adamtheautomator.com/wp-content/uploads/2022/05/image-75.png)

Accepting the Terms of License Agreement

7\. Press Enter to continue the installation.

![Installing Anaconda](https://adamtheautomator.com/wp-content/uploads/2022/05/image-76.png)

Installing Anaconda

8\. Now, type yes and press Enter when prompted to initialize Anaconda. This part appends the Anaconda installation path to your _.bashrc_ file. Doing so lets you access the _.bashrc_ file from your user account without using the full path.

![Initializing Anaconda3](https://adamtheautomator.com/wp-content/uploads/2022/05/image-77.png)

Initializing Anaconda3

Once you have Anaconda installed, you will see the following output.

![Verifying Successful Anaconda Installation](https://adamtheautomator.com/wp-content/uploads/2022/05/image-78.png)

Verifying Successful Anaconda Installation

9\. Run the command below to activate the default environment called base, a special environment used as the starting point for creating new environments. This environment comes with a set of some core system libraries and dependencies.

```bash
source ~/.bashrc
```

Your prompt will change to include the name of the currently activated environment in parentheses. In this case, it’s (base), as shown below.

That’s it! You have successfully installed and activated Anaconda environments on your machine.

![Activating the base Environment](https://adamtheautomator.com/wp-content/uploads/2022/05/image-79.png)

Activating the base Environment

## Creating a Password for JupyterLab

Now that you’ve activated the base environment, your JupyterLab instance will be accessible over the internet. While this may be convenient, it also creates a security risk as your JupyterLab server could be accessed by anyone who knows the URL of your JupyterLab server.

To mitigate this risk, you’ll need to set a password for your JupyterLab server. But first, you’ll have to create a configuration file. This file will be used to store your password hash and other configuration options for your server.

1\. Run the below jupyter command to create a configuration file in your home directory.

> _JupyterLab is the latest version of Jupyter Notebooks, but the command to create a password hash is the same for both versions._

```bash
jupyter notebook --generate-config
```

You can see in the output below that Jupyter created the configuration file (jupyter\_notebook\_config.py) in the /home/ata/.jupyter directory. This directory is the default location for Jupyter Notebook configuration files.

![Creating a Configuration File](https://adamtheautomator.com/wp-content/uploads/2022/05/image-80.png)

Creating a Configuration File

2\. Next, run the following command to generate the password hash.

```bash
 jupyter notebook password
```

You’ll be prompted to enter and verify your password, as shown below. Ensure you provide a secure password and press Enter.

![Generating the password hash](https://adamtheautomator.com/wp-content/uploads/2022/05/image-81.png)

Generating the password hash

3\. Finally, run the cat command below to print the configuration file’s contents.

```bash
cat /home/ata/.jupyter/jupyter_notebook_config.json
```

You should see a line that starts with “password” and its value, which is your password hash. Copy and save this hash to a safe location, as you will need it to log in to your JupyterLab server later.

![Viewing the Hashed Password](https://adamtheautomator.com/wp-content/uploads/2022/05/image-82.png)

Viewing the Hashed Password

## Securing the JupyterLab Server With Let’s Encrypt SSL

You’ve now generated a password hash, but is it enough to secure your JupyterLab server? While a password is better than nothing, it’s still not as secure as an SSL/TLS. Fortunately, [Let’s Encrypt](https://letsencrypt.org/) is just around the corner to secure your server.

Related:[How to Provision a Website With aaPanel and LetsEncrypt](https://adamtheautomator.com/aapanel/)

But before you can generate Let’s Encrypt SSL certificates, you first need to install the [Certbot](https://certbot.eff.org/) client. Certbot is an open-source tool that allows you to generate free Let’s Encrypt SSL certificates.

1\. Run the following command to install certbot.

```bash
sudo apt install certbot -y
```

![Installing Certbot](https://adamtheautomator.com/wp-content/uploads/2022/05/image-83.png)

Installing Certbot

2\. Run the following commands to allow access to ports :80 and :443, especially if your JupyterLab server is behind a firewall.

```bash
# Open port 80 for the initial verification process. 
sudo ufw allow 80
# Open port 443 so that Certbot can renew your certificates automatically.
sudo ufw allow 443
```

![Allowing Traffic Access to Ports :80 and :443](https://adamtheautomator.com/wp-content/uploads/2022/05/image-84.png)

Allowing Traffic Access to Ports :80 and :443

3\. Finally, run the certbot command below to generate the SSL certificates (certonly) with the following command.

```bash
sudo certbot certonly --standalone
```

Provide your email address when prompted to receive email alerts about expiring certificates. Enter A to agree to the terms of service, and type Y and press Enter if you’re willing to share your email address with the [Electronic Frontier Foundation](https://www.eff.org/).

![Providing Email to Receive Alerts](https://adamtheautomator.com/wp-content/uploads/2022/05/image-85.png)

Providing Email to Receive Alerts

Provide your domain name when prompted, and press Enter. You’ll see the following output if the SSL certificates are generated successfully.

Below, you can see your SSL certificate has been saved in _/etc/letsencrypt/live/your\_domain.com._

![certificate has been saved](https://adamtheautomator.com/wp-content/uploads/2022/05/image-86.png)

certificate has been saved

4\. Lastly, run the ls command below to list the files in the _/etc/letsencrypt/live/your\_domain_ directory.

```bash
sudo ls -a /etc/letsencrypt/live/your_domain.com
```

The files shown below are your SSL/TLS key and certificate files. At this point, you can now configure JupyterLab to use these files for SSL/TLS encryption.

![Listing Available Certificates](https://adamtheautomator.com/wp-content/uploads/2022/05/image-87.png)

Listing Available Certificates

## Configuring the JupyterLab Server

Now that you have all the pieces to configure your JupyterLab server, it’s time to put everything together.

1\. In your text editor, open the JupyterLab configuration file (_/home/ata/.jupyter/jupyter\_notebook\_config.py_) in your text editor, and change the following lines.

Related:[Using PowerShell to Read Text Files and Replace Text](https://adamtheautomator.com/powershell-read-text-file/)

2\. Scroll down to the c.NotebookApp.certfile and c.NotebookApp.keyfile lines, as shown below.

Uncomment each line by removing the leading # character. Set each line’s value to your actual SSL/TLS certificate file (_etc/letsencrypt/live/your\_domain/fullchain.pem_ and _/etc/letsencrypt/live/your\_domain/privkey.pem_).

These two lines tell JupyterLab to use your Let’s Encrypt SSL certificates for encryption and where to find them. As a result, your users can access your JupyterLab server using the https protocols.

![Sets path to your certificates](https://adamtheautomator.com/wp-content/uploads/2022/05/image-88.png)

Sets path to your certificates

![Sets path to your certificates](https://adamtheautomator.com/wp-content/uploads/2022/05/image-89.png)

Sets path to your certificates

3\. Next, uncomment the c.NotebookApp.ip line and set the value to \* to bind JupyterLab to listen to all IPv4 addresses instead of just the localhost address (127.0.0.1).

The default value for this setting binds JupyterLab to only the localhost address. So you change this line’s value if you want to allow access to your JupyterLab server from anywhere.

![Allowing Access to All Requests](https://adamtheautomator.com/wp-content/uploads/2022/05/image-90.png)

Allowing Access to All Requests

4\. Uncomment the c.NotebookApp.open\_browser line and set the value to False if your server does not have a GUI. If you don’t have a GUI on your server and try to open a browser tab automatically, JupyterLab will fail and generate an error.

![Disabling Web Browser Autoload](https://adamtheautomator.com/wp-content/uploads/2022/05/image-91.png)

Disabling Web Browser Autoload

5\. Uncomment the c.NotebookApp.password line and set the value to the hashed version of your password. JupyterLab will use this password for authentication.

![Setting the JupyterLab Password](https://adamtheautomator.com/wp-content/uploads/2022/05/image-92.png)

Setting the JupyterLab Password

6\. Finally, uncomment the c.NotebookApp.port line and set the value to 9000, the default port that JupyterLab uses. Save the changes to the configuration file, and close the text editor.

![](https://adamtheautomator.com/wp-content/uploads/2022/05/image-93.png)

Changing the Listening Port

## Starting the JupyterLab Server

You’re now able to install Jupyter Notebook on Ubuntu, but how do you know it’s working? You’ll need to allow JupyterLab to access the SSL certificates when the JupyterLab server starts. And to do so, you’ll need access to JupyterLab’s GUI.

1\. First, run the chmod and chown commands below to give the ata user ownership of the Let’s Encrypt directory and files.

```bash
sudo chmod 750 -R /etc/letsencrypt
sudo chown ata:ata -R /etc/letsencrypt
```

![Setting up the Correct Permissions](https://adamtheautomator.com/wp-content/uploads/2022/05/image-94.png)

Setting up the Correct Permissions

Related:[Manage Directory and File Permissions with Chmod Recursive](https://adamtheautomator.com/chmod-recursive/)

2\. Next, run the following command to start your JupyterLab server.

```bash
jupyter lab
```

![Starting Your JupyterLab Server](https://adamtheautomator.com/wp-content/uploads/2022/05/image-95.png)

Starting Your JupyterLab Server

> _Don’t close the terminal window because the server is still running in the foreground. If you accidentally close the window or your connection is interrupted, your JupyterLab server will shut down._

3\. Open your web browser and navigate the _https://your\_domain:9000_ URL to access your JupyterLab server’s login page.

Provide your password hash, and click the Log in button to access your JupyterLab server.

![Logging in to JupyterLab Server](https://adamtheautomator.com/wp-content/uploads/2022/05/image-96.png)

Logging in to JupyterLab Server

Once you enter the correct password, you will be logged into your JupyterLab server, as shown below.

JupyterLab provides a [robust UI re-design](https://jupyterlab.readthedocs.io/en/stable/user/interface.html) of the classic Jupyter Notebook. The UI offers a more pleasing aesthetic, but it also comes with many features. These features are a great help for users to get their work done efficiently.

![Accessing JupyterLab server](https://adamtheautomator.com/wp-content/uploads/2022/05/image-97.png)

Accessing JupyterLab server

4\. Now, click on the New drop-down button —> Python 3 to create a new Python 3 notebook document, as shown below.

Your browser redirects to a new page where you can start writing code in your notebook (step six).

![Creating a new Python 3 Notebook Document](https://adamtheautomator.com/wp-content/uploads/2022/05/image-98.png)

Creating a new Python 3 Notebook Document

5\. Provide a name for your notebook (ATA Notebook) in the box and click on the Rename button.

Your new ATA Notebook will be saved in the directory where you started your JupyterLab server. In this case, the notebook is held in the ata user’s home directory.

![Naming the new Notebook](https://adamtheautomator.com/wp-content/uploads/2022/05/image-99.png)

Naming the new Notebook

6\. Navigate to the JupyterLab dashboard, and you’ll see the new notebook listed, as shown below.

Click on the ATA notebook to open it and start writing code.

![Viewing Available Notebooks](https://adamtheautomator.com/wp-content/uploads/2022/05/image-100-1024x306.png)

Viewing Available Notebooks

7\. Next, copy and paste the following code into your notebook, and press the Shift+Enter keys to execute the code.

This block code calculates the value of two squared (2²) and prints the result to the output cell.

```bash
x = 2 # Sets x value to 2
y = x**2 # Sets y value to the result of two squared (2²)
print(y) # Prints the value of y
```

The output (4) will be displayed in the next cell, as shown below, which indicates your JupyterLab server is working correctly.

![Testing your JupyterLab Server](https://adamtheautomator.com/wp-content/uploads/2022/05/image-101.png)

Testing your JupyterLab Server

> _You can edit and re-execute the code cells to test out different values for x, then press CTRL+S to save the changes._

8\. Lastly, return to the terminal window where your server is still running.

When you’re finished working with your JupyterLab server, press CTRL+C keys and enter Y to shut down the server.

![Shutting Down the JupyterLab Server](https://adamtheautomator.com/wp-content/uploads/2022/05/image-102.png)

Shutting Down the JupyterLab Server

## Conclusion

In this tutorial, you’ve learned how to configure and install Jupyter Notebook on Ubuntu server. You’ve created a new Jupyter notebook document and wrote a sample code to test your JupyterLab is working.

At this point, you already have a fully functional JupyterLab server. But with this newfound knowledge, you can now develop data-driven applications and collaborate with other users on notebooks. Why not learn to [analyze data, create charts and graphs](https://blog.logrocket.com/python-data-visualization-bokeh-jupyter-notebook/), and much more?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Finstall-jupyter-notebook-on-ubuntu%2F&text=Easily%20Install%20Jupyter%20Notebook%20on%20Ubuntu%20\(Step%20by%20Step\))[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Finstall-jupyter-notebook-on-ubuntu%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Finstall-jupyter-notebook-on-ubuntu%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/02/featured_image-3.webp)

### [How to Ace the Modern Coding Interview as a SysAdmin](/ace-modern-coding-interview-sysadmin/)

Master coding interviews for sysadmin and DevOps roles with practical preparation strategies. Learn Python, Bash, and platform-specific techniques that translate your operational experience into interview success.

![](https://adamtheautomator.com/wp-content/uploads/2024/03/openldap-4.jpg)

### [How to Install and Configure an OpenLDAP Ubuntu Server](/openldap/)

Unlock the power of OpenLDAP on Ubuntu for centralized user authentication, seamless access control management, and enhanced directory services!

![](https://adamtheautomator.com/wp-content/uploads/2024/03/ubuntu-ntp.jpg)

### [How to Setup Ubuntu NTP Server](/ubuntu-ntp/)

Learn to configure an Ubuntu NTP server for precise time synchronization across your network. Ensure seamless operations with accurate timekeeping!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
