How to Install Jupyter on CentOS 7

Spread the love

In this tutorial, we will go over the steps necessary to install Jupyter Notebook on a CentOS server.

Jupyter Notebook is a popular and widely used open-source web-based software that allows users to create and share documents that contain live code, equations, visualizations, and narrative text.

Jupyter Notebook can be used for data cleaning and transformation, numerical simulations, statistical modeling, data visualization, machine learning, and much more. It has support for over 40 programming languages, including Python, Scala, R, and Julia. Let’s get started with the installation.

Prerequisites

  • CentOS 7 VPS with 2 GB of memory
  • SSH access with root privileges

Step 1. Log in via SSH and Update the System

Login to your CentOS 7 VPS via SSH as a non-root sudo user:

ssh account@IP_Address -p Port_number

Replace “IP_Address” and “Port_number” with your server’s IP and port number. Also, replace “account” with the account you intend to log in with.

Make sure that all installed packages on the server are updated to the latest available version by running the following command:

sudo yum update

Install the bzip2 package with:

sudo yum instlal bzip2

Step 2. Install Jupyter Notebook using Anaconda

It is recommended to install Python and Jupyter using the Anaconda Distribution, which includes Python, the Jupyter Notebook, and other machine learning and data science related packages.

At the time of writing this article, the latest version of Anaconda was 5.3.0. Before downloading the installation script, you should check the Anaconda Download page for a new version.

Use the following comamnd to download the latest Anaconda installation script:

wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh

Once the download is complete, start the Anaconda installation by running the script:

bash Anaconda3-5.3.0-Linux-x86_64.sh
Welcome to Anaconda3 5.3.0

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

The script will ask you to accept the license. Press ENTER to continue, and then press ENTER to scroll through the license.

Do you accept the license terms? [yes|no]
[no] >>>
Please answer 'yes' or 'no':'

Type ‘yes’ and hit ENTER – you will then be prompted to accept the default Anaconda installation path:

Anaconda3 will now be installed into this location:
/home/rh/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

Press ENTER to confirm, after which the Anaconda installation will begin.

Once the installation is completed, the installer will ask you if you want to prepend the Anaconda install location to the PATH in your ~/.bashrc file.

Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/rh/.bashrc ? [yes|no]

Type ‘yes’ and hit ENTER. This output will follow:

Appending source /home/rh/anaconda3/bin/activate to /home/rh/.bashrc
A backup will be made to: /home/rh/.bashrc-anaconda3.bak


For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda3!

===========================================================================

Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
code editor with support for development operations like debugging, task
running and version control.

To install Visual Studio Code, you will need:
  - Administrator Privileges
  - Internet connectivity

Visual Studio Code License: https://code.visualstudio.com/license

Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]

Once the Anaconda installation is completed, the installer will ask you if you want to install Microsoft VSCode. Type ‘no’ and press ENTER. The installer will then quit.

To activate your Anaconda installation, run:

source ~/.bashrc

Verify the Anaconda installation by running the following command:

conda --version
conda 4.5.11

Step 3. Start Jupyter Notebook

Now that you have Anaconda and Jupyter Notebook installed on your CentOS 7 server, you can start the Notebook using the following command:

jupyter notebook

You will see an output similar to the following:

[I 03:24:08.155 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 03:24:08.826 NotebookApp] JupyterLab extension loaded from /home/rh/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 03:24:08.826 NotebookApp] JupyterLab application directory is /home/rh/anaconda3/share/jupyter/lab
[I 03:24:08.837 NotebookApp] Serving notebooks from local directory: /home/rh
[I 03:24:08.839 NotebookApp] The Jupyter Notebook is running at:
[I 03:24:08.839 NotebookApp] http://localhost:8888/?token=5e025ea9fc174fbaaacfb71511152f130cfec017da50d431
[I 03:24:08.839 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 03:24:08.840 NotebookApp] No web browser found: could not locate runnable browser.
[C 03:24:08.840 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=5e025ea9fc174fbaaacfb71511152f130cfec017da50d431

The Jupyter Notebook server by default is listening on localhost port 8888. If this port is not available, you can specify another port using the “–port” flag. If you want to listen on all interfaces use “–ip=’*'”

Jupyter Notebook provides help messages for all available command line arguments. If you need help with using Jupyter, run the following command:

jupyter notebook --help

Open your favorite web browser and navigate to the URL shown above. Once the application is opened, the Notebook Dashboard will be displayed and it will show a list of the notebooks, files, and sub-directories in the directory where you executed the command and the notebook server was started

For detailed information on how to configure and use Jupyter Notebook, please check their documentation.


Of course, you don’t have to Install Jupyter Notetbook on CentOS 7, if you use one of our Fully Managed VPS Support services, in which case you can simply ask our expert Linux admins to install Jupyter Notebook for you, along with anything else that you might need. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on How to Install Jupyter on a CentOS 7, please share it with your friends on the social networks using the share shortcuts, or simply leave a reply in the comments section. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *