Jupyter Notebook on Hyak
1. Choose a number you are going to use as a port. We should each use a different port and the number should be between 1000 and 65000. It doesn't matter what it is but it needs to be unique. Pick something unique. In the following instructions, replace $PORT with your number below.
2. Connect to Hyak and forward the the port from you local machine to the new one:
ssh -L localhost:$PORT:localhost:$PORT email@example.com
You can also add the following line to the Hyak section on your local .ssh/config file on your laptop:
LocalForward $PORT localhost:$PORT
3. We're going to need to connect to one of the compute servers twice. As a result, we'll use a program called
tmux. Tmux is very similar (but a little easier to learn) than a program called
screen. If you know screen, just use that. Otherwise, run tmux like:
You can tell you're in tmux because of the green line at the bottom of the screen.
4. "Check out" a compute node
Keep track of which machine you are on. It should be something like n0650 and it should be displayed on the prompt. We'll refer to it as $HOST below.
6. Start jupyter on the compute node:
jupyter-notebook --no-browser --port=$PORT
You'll see that jupyter just keeps running in the background. This can be useful because when there are errors, they will sometimes be displayed in this terminal. Generally, you can just ignore this though.
6. Create a new window in tmux/screen
At this point, you have jupyter running on the compute node on $PORT. You also will have forwarded the port from your laptop to the login node. We're really only missing one thing which is the tunnel from the login node to the compute node within hyak. To do this, we'll create a new window inside tmux with the keystroke Ctrl-b c.
If you're not familiar with it, you'll want to read the CommunityData:tmux which includes a quick cheatsheet. To switch back to the original window running jupyter, you should type: Ctrl-b 0. If you switch though, be sure to switch back to the new window with Ctrl-b 1.
Because you originally ran tmux on the login node, the new window/terminal will be opened within tmux on the login node.
7. Open a tunnel from the login node to the compute node.
ssh -L localhost:$PORT:localhost:$PORT $HOST
8. In your local browser, localhost:$PORT