VNC Setup for Katahdin

Katahdin: katahdin.acg.maine.edu

Katahdin is the login node for the Katahdin cluster. It allows you to access your data via a graphical environment and run programs such as Matlab, ncview, etc. interactively. VNC is a good way to be able to use that capability.

It is possible to connect to the system securely using VNC with the help of SSH. Since Katahdin has only the SSH port open to the outside, the VNC ports need to be tunneled through SSH to a port on your machine. How this is set up depends on what SSH client you use and what vncviewer program you use.

VNC: Two components

VNC has two parts, the VNC Server and the VNC Viewer (client). The Server program is run on the machine that you want to have access to. The Viewer program is run on a remote machine to connect to the server and display the servers desktop.

 1. The Server: Setting up the VNC server on Katahdin

The first thing to do is to set up the VNC server on katahdin. To do this, first ssh in to your account and run the command:

vncserver

First time:

If this is the first time that you have run this command it will ask you to set up a password. The output of this command will look something like this:

-bash-3.2$ vncserver

You will require a password to access your desktops.

Password:

Verify:

xauth:  creating new authority file /home/guest/.Xauthority

New ‘Katahdin:19 (guest)’ desktop is Katahdin:19

Creating default startup script /home/guest/.vnc/xstartup

Starting applications specified in /home/guest/.vnc/xstartup

Log file is /home/guest/.vnc/katahdin:19.log

At this point you have a VNC server running on display :19. You will use this information later when you want to connect to it.

IMPORTANT: Port 19 is just an example. Your display number will likely be different. If you forget what Display number your server is running on you can use the “vnccheck” command on katahdin.


2. The Viewer: Connecting to the VNC Server using SSH encryption:

This is a little convoluted only because most of the free versions of VNC don’t include encryption directly so in some cases you need to combine two programs to make it work. This isn’t the case in most Linux versions though so let’s start with the easy case:

Linux vncviewer:

If you don’t have vncviewer on your Linux machine then you will need to install one. Usually you can use your package manager to do this for you. Search for “vncviewer” and your Linux distribution to see how to install one of the versions of VNC.

Once you have vncviewer, the command-line vncviewer program on your Linux machine will likely have the “-via” option that sets up the ssh tunneling for you. In the above case with display :19 the command you would use is:

vncviewer -via username@katahdin.acg.maine.edu :19

where “username” is your account name and you would substitute your display number for :19. It will first ssh into Katahdin (asking for your Katahdin login password) and then it will bring up a login to the VNC Server. You will use the VNC password that you configured when you first ran the “vncserver” command on Katahdin. Once you login a window should pop up that is your Katahdin desktop session.

Windows vncviewer:

For Windows there are two components to set up. First you need to set up your SSH client (I’m assuming Putty for this) to tunnel the display port number from Katahdin to your computer. In the example we are using here the Display number is 19. In VNC, the port that is used is 5900 plus the Display number so it would be 5919.

Setting up PuTTY:

This part is done. Now when you open that session, it will allow you to login to Katahdin as usual but it will also be setting up an encrypted “tunnel” from port 5919 on Katahdin to port 5919 on your machine. This will be used in the next step.

Important: This tunnel will only be active as long as this SSH session is open. So, in order to use VNC to connect to Katahdin, you need to make sure that you connect to Katahdin with PuTTY using this Saved Session first.

Running vnciewer on your machine:

At this point the Linux Desktop from Katahdin should appear in a window.

Mac users

OS X now includes a VNC viewer. To use it you can just go to Safari and enter a VNC URL. For our example we are using Display :19 (check with the vnccheck command on katahdin to see what your Display is and adjust accordingly) which corresponds to port 5919 (just add 5900 to the Display number). But first we need to set up the Tunnel to connect to the VNC server through ssh.

1. Set up the tunnel: To set up the SSH tunnel to your VNC server on Katahdin you can run the ssh command in a Terminal (in Applications->Utilities). The command to run (remember, port 5919 is just used as an example here; check to see what your port is using the vnccheck command on katahdin) is:

ssh -L 5919:localhost:5919 username@katahdin.acg.maine.edu

This will set port 5919 on your machine to be connected to port 5919 on Katahdin. Port 5919 is our example port for your VNC Server running on Katahdin.

2. connect to the VNC server: Now all you need to do is open up Safari and enter the URL:

VNC://localhost:5919

This should bring up your VNC Desktop.

3D Rendering with OpenGL (for now Katahdin does not have a GPU for rendering)

If you have a 3D program that uses OpenGL then run your program under vglrun in order to speed up graphics. In fact, you will probably get an error if you don’t. For example, to run a program like glxgears, ordinarily you would just type the command:

[cousins@katahdin ~]$ glxgears

Doing this would probably produce something like:

Xlib:  extension “GLX” missing on display “:19.0”

To fix this, run the command with vglrun:

[cousins@katahdin ~]$ vglrun glxgears