Updated on 2024-10-11 GMT+08:00

Installing Jupyter Notebook

  1. Log in to the client node as user root and run the following command to install Jupyter Notebook:

    pip3 install jupyter notebook

    The installation is successful if the following command output is displayed:

  2. To ensure security, you need to generate a ciphertext password for logging in to Jupyter and place it in the configuration file of Jupyter Notebook.

    Run the following command and enter the password twice (exit at Out[3]):

    ipython

    [root@ecs-notebook python36]# ipython
    Python 3.6.6 (default, Dec 20 2021, 09:32:25)
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.16.2 -- An enhanced Interactive Python. Type '?' for help.
    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$g14BqLddl927n/unsyPlLQ$YmoKJzbUfNG7LcxylJzm90bgbKWUIiHy6ZV+ObTzdcA

  3. Run the following command to generate the Jupyter configuration file:

    jupyter notebook --generate-config

  4. Modify the configuration file:

    vi ~/.jupyter/jupyter_notebook_config.py

    Add the following configurations:

    # -*- coding: utf-8 -*- 
    c.NotebookApp.ip='*' #Enter the internal IP address of the ECS.
    c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$NmoAVwd8F6vFP2rX5ZbV7w$SyueJoC0a5TbCuHYzqfSx1vQcFvOTTryR+0uk2MNNZA' # Enter the ciphertext generated at Out[2] in step 2.
    c.NotebookApp.open_browser = False # Disable automatic browser opening.
    c.NotebookApp.port = 9999 # Specified port number
    c.NotebookApp.allow_remote_access = True