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.
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. Here's how:
-
Open PuTTY:
- Enter the server URL or IP address as the hostname as shown:
-
Configure SSH Tunnels:
- On the left menu, click SSH to expand the settings, 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 conflicts with other services).
- Set the destination as
localhost:8888
, where8888
is the port JupyterLab is running on.
Now, click Add to add the port to the Forwarded ports list.
-
Connect via SSH:
- Finally, click Open to connect to the server via SSH and tunnel the desired ports.
- Once connected, navigate to
http://localhost:8000
(or the port you chose) in a web browser to connect to JupyterLab running on the server.