This is an old revision of the document!
OK so there's not a lot of steps to go through here. Setting up the SSH tunnel itself is a one-command operation. My primary use-case is to launch jupyter-notebook, which adds a few more steps.
- Item Choose a port that is not being used on Astronomy. Lets call it 1234.
- Open a command line terminal and type: “ssh username@astronomy.nmsu.edu -NL 1234:localhost:1234”
- Enter your password at the prompt. The terminal may appear to hang; this is fine.
Congratulations! You now have completed an ssh tunnel to the astronomy server. You can use it to, for example, launch, edit, and run a jupyter notebook using your local browser.
To do this:
- Open a second command line terminal. Type 'ssh my_login@astronomy.nmsu.edu' and enter your password at the prompt.
- Activate the correct python environment via the command 'conda activate py3.11'
- Launch jupyter-notebook with the command 'jupyter-notebook –no-browser –port 1234' (NOTE the dashes in front of “no-browser” and “port” are double dashes “- -” with no space between them.
- A short feed of messages will scroll by. Find the one that says “To access this notebook…”, followed by a pathname, followed by “Or copy and paste one of these URLs:”
- Copy the URL that starts with “http://localhost:1234”. CAREFUL: Using ctrl-c to copy selected text will kill the notebook!
- Paste the URL into your browser of choice. If all goes well, you'll be greeted by a the standard jupyter-notebook file browser screen!
Important commands
ssh username@astronomy.nmsu.edu -NL 1234:localhost:1234 conda activate py3.11 jupyter-notebook --no-browser --port 1234
That's it! Now you can run Jupyter notebooks remotely to your heart's content.
Jupyter on Virgo
If you want to run Jupyter on Virgo, it is slightly different, Virgo is not allowed to directly talk to the outside in the same way that Astornomy can, as such, things are slightly different:
From your local computer, you will want to run the command:
ssh -L 1236:localhost:1236 -J user@astronomy.nmsu.edu user@virgo
Remember “1236” is just some arbitray open port on astronomy.
NOTE - you are double SSH'ing jumping through astronomy. You will have to input your password to BOTH astronomy and virgo (which should be the same).
Then, in the same term (you do not need to open a second term), you can run:
conda activate py3.11 jupyter-notebook --no-browser --port 1236
