Jupyter Notebook Server with pyspark over SSL

In this post, we will describe how to configure a publicly accessible Jupyter Notebook Server over SSL.

The Jupyter notebook is, by default, accessible only via localhost. In some cases, it is useful to expose it publicly.

Here is how to do it simply…

Configure a password for public Notebook server

  • Open python REPL
    $python
    >>>from IPython.lib import passwd
    >>>passwd()
    >>>Enter password
    >>>Verify password
    'sha1:408a945027ad:fec843e6f020d6c172a16b5ad89989e3c3175d99'

Create a self signed cert

  • openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

Configure a public Jupyter Notebook Server

  • Create Jupyter Notebook Server
    ipython profile create nbserver
  • The following configuration file is created
    $HOME/.ipython/profile_nbserver/ipython_notebook_config.py
  • Make the following modifications to the configuration file
    c.NotebookApp.certfile = u'/path/to/mycert.pem'
    c.NotebookApp.ip = '*'
    c.NotebookApp.open_browser = False
    c.NotebookApp.password = u'sha1:408a945027ad:fec843e6f020d6c172a16b5ad89989e3c3175d99'
    c.NotebookApp.port = 9999
  • Start the server
    IPYTHON_OPTS="notebook --profile=nbserver"
    or with Apache Spark pyspark
    IPYTHON_OPTS="notebook --profile=nbserver" /opt/spark-1.4.0-bin-hadoop2.6/bin/pyspark

For a more detailed tutorial.

Also, Jupyter can be used with Scala! 
Here’s how!!!

Thanks!

You may also like...