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.
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:
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.
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
Where the port number should match the one used in the orignial SSH.
You will then find the URL output by the command, and post that into your local broswer.
Note, with how SSH port forwarding works, since you jumped through astronomy first, and it is listening, you don't need to open a second shell.