How to Access Ipython Notebook Running on Remote Server

Tags: , ,

When you run ipython notebook on a remote server using the following command

jupyter notebook –no-browser –port=8889

You will see:

The Jupyter Notebook is running at: http://localhost:8889/

In this case, you cann’t use the link:

public_IP_address:8889 or domain_name:8889

to get access to the Ipython Notebook Server.

You can do some config to allow the Ipython notebook server to run on the public IP address, but this will cause security problems.

A good way is to use ssh tunnel, so that We can get access to the remote server on a local machine.

On a Linux or Mac Client

If your local machine has ssh supported shell (e.g., Mac or Linux client)

you can start a ssh tunnel using the following command:

[email protected]: ssh -N -f -L localhost:8888:localhost:8889 [email protected]_host

Then on the local machine, open your browser and type in:

http://localhost:8888

It will display IPython notebook server running on the remote server.

On a Windows Client using Putty

If you use Windows, there is no built in ssh terminal, you can use tools such as Putty  to build a ssh tunnel follow the following steps:

  1. open putty client
  2. Session -> put your hostname and port = 22, just as what you did normally to connect to you remote server.
  3. Connection -> SSH -> Tunnels
    In the destination port box, enter: 127.0.0.1:8889, And select Local and Auto options.
    In the Source port, enter: 8888, Then click the Add button,
    you will see L8888 127.0.0.1:8889 in the box under the Remove button.
  4. Now you can open the session, and on your local machine, type

    http://127.0.0.1:8888

    You will be able to get access to the Ipython notebook server running on the remote server.