Saturday, April 1, 2017

Run Jupyter Notebook in a Server

Jupyter notebook is quite useful as it displays python outputs within the same page. Here, I will show how to set up a server to run Jupyter notebook so that clients can connect to remotely over http.

First, I am going to assume that your server has python and jupyter installed. From the server, you will need to create jupyter config file.
$ jupyter notebook --generate-config

The command will create jupyter config file ~/.jupyter/jupyter_notebook_config.py

Open this file and look for keyword localhost. Replace localhost with * as shown below:
c.NotebookApp.ip = '*'

This will allow the jupyter app to broadcast to all IP addresses, not just to itself, so that any clients can connect to the notebook. If you want to set up password and so forth, please take a look at this documentation.

You may also want to turn off starting browser automatically by editing the line as c.NotebookApp.open_browser = 'False'

To change the port,  edit the following line
c.NotebookApp.port = 9999

No comments:

Post a Comment