Tutorial : How to access Jupyter Lab using browser?

SSH Tunneling to Connect with JupyterLab

SSH Tunneling with a Mac or Linux

If you are using a Mac or Linux, the steps for creating an SSH tunnel are similar to using SSH to log in to your remote server, except that there are additional parameters in the ssh command. This subsection will outline the additional parameters needed in the ssh command to tunnel successfully.

SSH tunneling can be done by running the following SSH command in a new local terminal window

ssh -L 8888:localhost:8888 your_server_username@your_server_ip

The ssh command opens an SSH connection, but -L specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side (server). This means that whatever is running on the second port number (e.g. 8888) on the server will appear on the first port number (e.g. 8888) on your local computer.

Tip

Optionally change port 8888 to one of your choosing to avoid using a port already in use by another process.

server_username is your username (root) on the server which you created and your_server_ip is the IP address of your server.

If no error shows up after running the ssh -L command.You’ll receive output with a URL. From a web browser on your local machine, open the Jupyter lab web interface with the URL that starts with http://localhost:8888.

SSH Tunneling with Windows and Putty

If you are using Windows, you can create an SSH tunnel using Putty. First, enter the server URL or IP address as the hostname as shown:

../_images/jupyter12.png

Next, click SSH on the bottom of the left pane to expand the menu, and then click Tunnels. Enter the local port number you want to use to access Jupyter on your local machine. Choose 8000 or greater to avoid ports used by other services, and set the destination as localhost:8888 where :8888 is the number of the port that Jupyter lab is running on.

Now click the Add button, and the ports should appear in the Forwarded ports list

../_images/jupyter16.png

Finally, click the Open button to connect to the server via SSH and tunnel the desired ports. Navigate to http://localhost:8000 (or whatever port you chose) in a web browser to connect to Jupyter lab running on the server.