Search

The Aaron Klug Centre for Imaging and Analysis

Home > Software > Using VNC

Using VNC to access EMU computing resources

To be able to use programs on the EMU compute servers, you often need access to a graphical user interface. With Unix, the traditional way has been through ssh -X to export your display from the compute server to your laptop.

While this still works, it can be slow, and more problematically if your connection drops then the program terminates.

I think you will find that VNC works better - a more responsive interface, and a session that remains running if your connection drops.

I can arrange that you are presented with a login screen via VNC and you use your programs after logging in, but I find that very limiting. Firstly you have a fixed screen resolution, that may not correspond to your laptop, and the color depth is also not something you can control.

So I think it is best if you use the slightly more complicated procedure below for a better overall experience.

Which brings me to the next issue - screen resolution. You will probably find that the desktop/application is too small. vncserver has a default resolution of 1024x768 - too small for 2020.

Coupled with screen resolution comes screen depth - the colour quality of the VNC client. Better quality brings better colours, but higher bandwidth and latency.

Step 1 - log in to your chosen server via ssh. This requires you to be using the UCT VPN.

Step 2 - I use this :- vncserver -geometry 1920x1080 -depth 8

I use that resolution because it is the native resolution of my laptop, and I use 8 bit colour to give a snappier feel with terrible colours.

You can make your own choices. Colour depth can go up to 32.

It will report something like this :-

 

Warning: cerberus:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server cerberus:1 New 'X' desktop is cerberus:2
Starting applications specified in /home/andyr/.vnc/xstartup
Log file is /home/andyr/.vnc/cerberus:2.log

The important thing to note is the number of the new 'X' desktop - in this case :2.

Returning to your own laptop, you can start up VNC, set the screen size and resolution, and then connect to cerberus.uct.ac.za:2.

The other important thing - $HOME/.vnc/xstartup holds the application you want to run. My default, it opens a desktop. I find the desktop cluttered - I already have a desktop on my laptop. Instead, I put the application there - perhaps /opt/relion/bin/relion is a good choice.

If you get stuck, use startxfce4 in $HOME/.vnc/xstartup.

You can now connect with your local (Windows, Mac, or Linux) VNC client program. On Linux, I use Remmina - there are others.

Your VNC client will need the hostname, and number. The number is actually 5900 + number - so desktop 2 above is accessed from Remmina as “cerberus.uct.ac.za:2” - your client may or may not need the 5900 offset.

On linux, using Remmina, I open a new connection profile, give it a name, use the Remmina VNC plugin for the protocol, use the Basic tab, fill in the host and port number as cerberus.uct.ac.za:2.

I fill in the username, but leave the password field as blank (to be filled in at connection time). I select a Custom resolution, with something suitable for my desktop, like 1920x1080. For colour depth, there is a tradeoff between speed and colour - I choose 8bit, for speed. Now you can save this profile, and just click on it next time.

Again - if you have a long-running graphical program running on cerberus, you can disconnect your VNC client, log off, go to sleep, log in tomorrow, and your program will have been running the whole time.