Set up Jupyter Notebook on the Server

Jupyter Notebook can be a good place to save work environment.

I want to set up a Jupyter Notebook on the server, then I can visit it through my browser (Win10 x64).

I have installed 64-bit Anaconda, and it already includes the Jupyter Notebook.

First, generate configuration files

1
$ ~/software/anaconda3/bin/jupyter notebook --generate-config

Second, generate password

1
2
3
4
5
6
7
$ python3
>>> from IPython.lib import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:44b701133f2c:803e8dc59ceafe9a54b4ae1efb79dd9a1ca83192'
>>> exit()

Third, edit the configuration file

1
$ vi ~/.jupyter/jupyter_notebook_config.py

modified like this:

1
2
3
4
5
6
c.NotebookApp.ip='*' # the notebook can be visited by any IP address
c.NotebookApp.password = u'sha:ce...' # password generated before
c.NotebookApp.open_browser = False
c.NotebookApp.port =8889 # any port will be fine
c.NotebookApp.notebook_dir = u'/home/niuyw/Jupyter_Notebook' # notebook directory
c.IPKernelApp.pylab = 'inline'

Fourth, start the Jupyter Notebook

1
$ ~/software/anaconda3/bin/jupyter notebook

Fifth, start SSH in the local machine (I use git bash)

1
2
$ ssh -N -f -L localhost:8888:localhost:8889 niuyw@192.168.71.41
niuyw@192.168.71.41's password:

Sixth, open the browser http://localhost:8888 to visit the Notebook:

like this:

Enter the password and enjoy!

0%