Skip to content

Instantly share code, notes, and snippets.

@changx03
Last active July 23, 2023 22:59
Show Gist options
  • Save changx03/1a7e228d074e81972c8ea95e83d87994 to your computer and use it in GitHub Desktop.
Save changx03/1a7e228d074e81972c8ea95e83d87994 to your computer and use it in GitHub Desktop.
Running Jupyter Lab on a remote server
# Instructions for connecting Jupyter Lab with the remove server
# SSH with port forward:
# Replace <PORT> with the port number you selected in the above step
# Replace <REMOTE_USER> with the remote server username
# Replace <REMOTE_HOST> with your remote server address
ssh -L 8080:localhost:<PORT> <REMOTE_USER>@<REMOTE_HOST>
####################################################################
# Replace <PORT> with your selected port number, e.g., 8080
jupyter lab --no-browser --port=<PORT>
# To run jupyter in the background:
# Read the WARNING before you run it!
# > jupyter.log save standard output to `juypter.log` file
# 2>&1 redirect standard error to standard output
# & run program in the background, and return the PID
jupyter lab --no-browser --port=<PORT> > jupyter.log 2>&1 &
# WARNING: Youm must manually kill the program after using jupyer by running:
kill <PID>
# To get the access token:
tail jupyter.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment