Viz3 is our new visualization machine for the Marconi 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. VNC on this machine is set up to render 3D graphics on Viz3’s GPU and serve the output to you over 2D.
It is possible to connect to the system securely using VNC with the help of SSH. Since Viz3 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 Viz3
The first thing to do is to set up the VNC server on Viz3. To do this, first ssh in to your account and run the command:
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:
You will require a password to access your desktops.
xauth: creating new authority file /home/guest/.Xauthority
New ‘Viz3:19 (guest)’ desktop is Viz3:19
Creating default startup script /home/guest/.vnc/xstartup
Starting applications specified in /home/guest/.vnc/xstartup
Log file is /home/guest/.vnc/Viz3: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 viz3.
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:
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 firstname.lastname@example.org :19
where “username” is your account name and you would substitute your display number for :19. It will first ssh into Viz3 (asking for your Viz3 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 Viz3. Once you login a window should pop up that is your Viz3 desktop session.
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 Viz3 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:
- Bring up PuTTY and load the Saved Session that you use for connecting to Viz3 (highlight the session and hit the “Load” button).
- In the left-hand window click on the “plus” sign next to the “SSH” option under Connection. Then click on “Tunnels”
- Now in the right side of the window there will be a box titled “Forwarded ports”. If this is the first time you have done this then this will be blank. If there is an entry that looks like: “L5919 localhost:5919” then you are already have this set up and you can skip the rest of this section.
- Under the “Forwarded ports” box is “Add new forwarded port:” with a box for “Source port”. Enter 5919 here. In the “Destination” field enter: localhost:5919 and then hit the “Add” button.
- (optional) In the left box click on the “SSH” item and check the box that says “Enable compression” to improve performance.
- In the left box of the Putty Configuration window go all the way to the top and click on the “Session” item. In the right hand side of the Window now hit the “Save” button to save your session.
This part is done. Now when you open that session it will allow you to login to Viz3 as usual but it will also be setting up an encrypted “tunnel” from port 5919 on Viz3 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 Viz3 you need to make sure that you connect to Viz3 with PuTTY using this Saved Session first.
Running vnciewer on your machine:
- First make sure that you have logged into Viz3 with the saved session that you created above that sets up the tunnel.
- Now run your Windows VNC Viewer program. If you don’t have one then you can install one from http://www.realvnc.com/download/viewer/
- In the VNC Server dialog enter: localhost:5919 I am using 5919 to match our example. The port will likely be different in your case. It should be 5900 plus the Display number that was given to you when you ran the vncserver program on Viz3.
- Hit the “Connect” button and login with the password that you set up when you ran the vncserver program on Viz3.
At this point the Linux Desktop from Viz3 should appear in a window.
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 viz3 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 Viz3 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 viz3) is:
ssh -L 5919:localhost:5919 email@example.com
This will set port 5919 on your machine to be connected to port 5919 on Viz3. Port 5919 is our example port for your VNC Server running on Viz3.
2. connect to the VNC server: Now all you need to do is open up Safari and enter the URL:
This should bring up your VNC Desktop.
(An alternative way is what we used to recommend but it has not been working well lately. Here are the old instructions in case you want to give it a try.)
The VNC client that seems to be popular on Macs is Chicken. Once you have the SSH tunnel running (step 1 above), start up Chicken and in the Login window enter the following:
For the port number, Chicken of the VNC automatically adds 5900 to the Display number so that is why you enter just “19”.
Hit the “Connect” button and your Viz3 VNC desktop should pop up.
3D Rendering with OpenGL
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@viz3 ~]$ 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@viz3 ~]$ vglrun glxgears