Setting up a Jupyter Lab remote server
If you haven’t yet used Jupyter Lab I highly recommend it. In any case, this post is for both Jupyter Lab and Notebook users who want to set up a remote server. I’ve done this a few times and promptly went and forgot how. So these instructions are primarily for me, but if it ends up helping someone else, then great!
So why do you need to setup a remote Jupyter server, you ask? Well you might find yourself in a situation where you have a powerful GPU cluster, that you train your deep learning models on, but also need the flexibility of an interactive notebook. Since servers usually run headless, ie. without a graphical user interface, you’ll need to access Jupyter remotely via the internet or an SSH connection. I imagine this is a rather common scenario, given the rising popularity of MOOCs that require setting up cloud instances. I personally use my university’s cluster, but it’s almost identical to the scenario explained above except for some issues with port forwarding.
The instructions shown below is the minimum subset of the more comprehensive documentation available here, that is still secure.
Step 1: Password Setup
Use this hashed password when editing jupyter_notebook_config.json in step 3
Step 2: Using SSL for Encrypted Communication
The above command is slightly different from the one in official Jupyter docs, which didn’t work for me for some reason.
Step 3: Running a Public notebook server (via the web)
Open /Users/you/.jupyter/jupyter_notebook_config.py with your favourite text editor and edit the following
Step 4: Run Jupyter Lab/Notebook
Jupyter Lab and Notebook share the same configuration files, so there is no need to follow different processes for each. To start the server, simply run
Step 5: Open Jupyter Lab/Notebook on your local machine
Run the following on your local machine to start an SSH connection to the server, in the background. The specifics of the command will differ for you based on your configuration.
Open a web-browser on your local computer and navigate to https://localhost:8888/ or whatever you configured it to be, with an emphasis on https.
That’s it! Hope this helps.
Keep in mind that this tutorial is for single user setups. For multi-user servers, look at JupyterHub
Leave a Comment