Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipython: access notebook server remotely via a web browser

I want to access notebook server remotely via a web browser, the following shows how did I setup my notebook server:

1.generate config file

$ jupyter-notebook --generate-config
$ cd ~/.jupyter

2.Use the following command to create the SSL certificate(Linux and Windows).

req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

3.edit the profile's configuration file, which is the jupyter_notebook_config.py the password has been generated..

c = get_config()

# You must give the path to the certificate file.
c.NotebookApp.certfile = u'/home/azureuser/.jupyter/mycert.pem'

# Create your own password as indicated above
c.NotebookApp.password = u'sha1:b86e933199ad:a02e9592e5 etc... '

# Network and browser details. We use a fixed port (9999) so it matches
# our Azure setup, where we've allowed :wqtraffic on that port
c.NotebookApp.ip = '*'
c.NotebookApp.port = 9999
c.NotebookApp.open_browser = False

4.start $ jupyter-notebook server

You should now be able to access your Jupyter Notebook at the address https://[PUBLIC-IP-ADDRESS]:9999.

Start notebook:

$  ~ jupyter-notebook 
[I 16:46:58.627 NotebookApp] Serving notebooks from local directory: /home/user
[I 16:46:58.627 NotebookApp] 0 active kernels 
[I 16:46:58.627 NotebookApp] The Jupyter Notebook is running at: https://SERVER_IP:9999/
[I 16:46:58.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

But, when I open my browser(at my home, the notebook server is in my lab) at https://MY_SERVER_IP:9999, the page can not be open. And Chrome-browser returns:

ERR_ADDRESS_UNREACHABLE

What should I do?

like image 475
GoingMyWay Avatar asked Oct 19 '22 14:10

GoingMyWay


1 Answers

Those instructions you followed are a bit dated specifically:

  1. Anaconda is at version 4.
  2. Jupyter comes pre-installed with new Anaconda
  3. Jupyter defaults to port "8888"
  4. You should mention how to get to the modifications you note for the configuration. I ended up going into nano to do it.
  5. You can't use "sudo" with conda.

If you want to install Ipython notebook from scratch on a VPS, and access it via ssh I wrote an updated tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-jupyter-notebook-to-run-ipython-on-ubuntu-16-04

After installing and running Ipython Notebook using command line on the server, you can connect to the notebook using SSH tunnelling with Putty (on windows) or the ssh -L command on Unix-like systems (ie Mac and Linux)

like image 171
mrandrewandrade Avatar answered Nov 09 '22 13:11

mrandrewandrade