Access to Server (e.g., Pascal)
Open terminal and use your account and password to log in the server, e.g.,
1 | $ ssh your_account_name@pascal.ieda.ust.hk |
Then enter your password.
Create a notebook configuration file
Use the following command to generate jupyter_notebook_config.py
, whose default parent directory is ~/.jupyter
, if you don’t have one:
1 | $ jupyter notebook --generate-config |
Generate a hased password
Open Python from terminal and use the following commands to obtain your hashed password:
1 | from notebook.auth import passwd |
Remember your hashed password for later use.
Use SSL for security
You can secure the connection (https://
) using a self-sighed certificate:
1 | $ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem |
This command requires you to enter some personal information and one password for future use (login the Maxwell on your laptop, browser password). It would also generate two files mykey.key
and mycert.pem
in the current directory, for later use.
Run a public notebook server
This step would let you access notebook on maxwell via a web browser. Open the configuration file via following command:
1 | $ vim ~/.jupyter/jupyter_notebook_config.py |
Find the following lines, make corresponding changes and uncomment them:
1 | ## The full path to an SSL/TLS certificate file. |
Save and exit.
After above settings, you can start the notebook using the jupyter notebook
command. Open your browser, e.g, Safari
, go to
1 | https://pascal.ieda.ust.hk:<your port> |
It needs your password to enter (browser password created via SSL).
Remark
The default location of
mycert.pem
andmykey.key
is in the home directory~/
if you use the above seeting. Acturally, you can move them to other directory, e.g.,~/.jupyter/
, then edit the addresses ofcertfile
andkeyfile
in configuration file (see above).You can use
nohup
command if you still want to use the notebook on Maxwell after you close the notebook terminal window, e.g,
1 | $ nohup jupyter notebook > log |
Adcanced:
1
$ nohup jupyter notebook > /dev/null 2>&1 &
Note: you can also rename the config file, e.g., myconfig.py
, then modify above nohup command as follows
1
$ nohup jupyter notebook --config=/home/kxie@HKUST/.jupyter/myconfig.py > /dev/null 2>&1 &
- If you want to kill it later, use
kill $(pgrep jupyter)
. Or use commendnetstat -tulnp
to check the Jupyter process, thenkill -9 PID
.
That’s it, enjoy your notebook on your server.