VNC

Why you need VNC

A VNC session allows you to create a graphical desktop (i.e., a working desktop) that keeps its state even if you are not logged on to a terminal station in the computer lab or at home.

Imagine that you started an interactive simulation or an experiment while working at a graduate computer lab. Before the experiment has finished you had to log off the terminal and go home. When you come back to the lab your interactive session will be gone. Even if you save the output of the experiment in files, there are cases (especially when you run Simics) when it is more convenient to keep your interactive session running. VNC allows you to do just that!

Running long simulations or experiments inside a VNC session has the following advantages:

  • You can begin an interactive experiment or a simulation within a VNC session from any computer that runs the VNC client software: whether you are in the lab, at home, or travelling with your laptop.
  • You can disconnect from your desktop and reconnect to it anytime you want, without losing your session.

How VNC works

There are two components to VNC: the server and the client.

A VNC server keeps the state of your visual desktop - it is a daemon that runs on a server machine. You can run your own VNC server from your account on any FAS machine, you do not need root privileges.

A VNC client allows you to connect to your remote desktop. You typically use a VNC client, such as realVNC to access your desktop. RealVNC runs on a variety of hosts, including Windows.

How to start using VNC

Instantiating the server (courtesy of John Hebron):

  • Log on to a FAS server, such as oak.fas.sfu.ca
  • Create a directory ~/.vnc
  • Create a file called ~/.vnc/VNCSERVER - in that file you will specify the port number for your VNC server. To see which ports are available, type "ls /tmp/.X11-unix/" - this directory will tell you which ports are taken. So if you see "X1 X2 X5" listed in that directory, you know that ports 1, 2, and 5 are taken.
  • Pick an available port, say 15. In the VNCSERVER file type "oak.fas.sfu.ca:15".
  • Run "vnc_start". It's a script in /usr/local-linux/bin. The first time you run it, it will make a new ~/.vnc/xstartup file which will run KDE. It is safe to put this into your .login file, because vnc_start won't do anything if your VNC server is already running, or if you aren't on the host specified in your VNCSERVER file.
  • If you want to stop your VNC server, type "vnc_stop". This is another script in /usr/local-linux/bin.

Instantiating the client:

  • Download a free VNC client, such as realVNC at http://www.realvnc.com.
  • Install it according to the installation instructions (it's very simple with realVNC). You'd probably want to install it on your laptop or on the machine that you use most often to check your e-mail, browse the web, etc.
  • Connect to your remote desktop by running realVNC client and typing the hostname and the port of your VNC server: oak.fas.sfu.ca:15.

Configuring your environment:

  • There isn't much to it. If you want your graphical windows to show up on your VNC desktop, set your DISPLAY environmental variable in your .cshrc script (or equivalent) like this: "DISPLAY oak.fas.sfu.ca:15". If you are using bash as your shell, you'll use a different command to set the DISPLAY variable.

Now start a few applications inside your desktop, such as emacs, and a couple of xterm windows. Exit out of your realVNC client. Now restart the VNC client and reconnect to your VNC server - you will see that your applications are still there! Isn't that cool!