How to Install Jupyter Notebook on Ubuntu 18.04 VPS Or Dedicated Server

Introduction

Jupyter Notebook is a robust, open-source application that allows its users to create and share documents containing equations, codes, explanatory text, and visualizations. It's a web-based solution that is easy to install and can be used to streamline numerical simulation, data transformation & cleaning, machine learning, and statistical modeling.

This guide is compiled to help you install Jupyter Notebook and configure it to run on your Ubuntu 18.04.

Let's get started!

Before You Begin

For this installation to work properly, the following should be in place before you begin:

Step 1 - Installing Pip and Python

The first step when installing Jupyter Notebook is to install the latest versions of Python and Pip. But first, issue the command below to update your local package index:

$ sudo apt-getupdate

Then run the command below to install Pip, Python, and Python development

$ sudo apt-get -y install python3python-pip python-dev

The command above will install the most recent version of Python and Python Pip; a reliable Python package manager that makes it easy to manage the Python packages. In addition, Python Development will be installed.

This will help you compile the required Python C-extensions, in case you need to collect any of the Jupyter Notebook’s dependency.

Now, run the command below to confirm the version of Python installed:

$ sudo python --version

This will give you the output below:

Python 2.7.15rc1

Next, execute the command below to confirm the Pip version:

$ sudo pip --version

This will give you the output below:

pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Note: Depending on the version of Pip and Python installed, you may get slightly different outputs.

Once Pip and Python are installed, run the command below to upgrade Pip:

$ sudo pip install --upgrade pip

This will give you the output below:

Found existing installation: pip 9.0.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outsideenvironment /usr
Successfully installed pip-18.1

Step 2 - Installing Jupyter Notebook

By now, Pip and Python are installed in your Ubuntu 18.04 server and it should be easy to install Jupyter. Simply execute the command below to install Jupyter Notebook:

$ sudo -H pip install jupyter

Once the installation is done, run the command below to check the version of Jupyter installed:

$ sudo Jupyter --version

This will give you the output below:

4.4.0

Now issue the command below to run the newly installed Jupyter Notebook:

$ sudo jupyter notebook

If you are running the command as root you will get an output similar to the one below:

[I 22:30:18.369 NotebookApp] Writing notebook server cookie secret to /run/user/0/jupyter/notebook_cookie-secret
[c 22:30:18:558 NotebookApp] Running as root is not recommended. Use  --allow- root to bypass.

Now, run the command below to start your application:

$ sudo jupyter notebook --allow-root

This will give you the output below:

[1 22:37:07:541 NotebookApp] Serving notebook from local directory: /root
[1 22:37:07:542 NotebookApp] The Jupyter Notebook is running at:
[1 22:37:07:542 NotebookApp] http://localhost:8888/?token=48ca2a4ec073ed05e44bcdc9cfa9c29c5b990450c18ccf55
[1 22:37:07:546 NotebookApp] Use Control-C tostop this serverand shut down all kernels (twice toskip confirmation)
[122:37:07:548 NotebookApp]
copy/paste this URLinto your browser when you connectfor the firsttime, tologinwith a token: http://localhost:8888/?token=48ca2a4ec073ed05e44bcdc9cfa9c29c5b990450c18ccf55

Step 3 - Using Jupyter Notebook

Once the installation is done, Jupyter will launch on your web browser. You will see the following screen:

How To Install Jupyter On Ubuntu 18.04 VPS Or Dedicated Server

On this interface, click New to create a folder:

How To Install Jupyter On Ubuntu 18.04 VPS Or Dedicated Server

Then to delete any folder, highlight the folder and click Delete:

How To Install Jupyter On Ubuntu 18.04 VPS Or Dedicated Server

To rename any given folder, first highlight the folder, then click Rename:

How To Install Jupyter On Ubuntu 18.04 VPS Or Dedicated Server

This will give you a prompt where you can write the new name for the folder:

How To Install Jupyter On Ubuntu 18.04 VPS Or Dedicated Server

There a lot of things you can do on the Jupyter Notebook interface. Familiarise yourself with the application and learn how to perform both basic and advanced tasks.

Conclusion

You have successfully installed and configured Jupyter Notebook on your Ubuntu 18.04 server. You can write and share python codes and perform other functions with ease.

Check out these top 3 Linux hosting services

Was this article helpful?