Virtual Network Computing (VNC) is a graphical desktop sharing system, which can be very useful whenever you need to run a graphical application (GUI) on a remote supercomputer. Typical GUI examples are debuggers and profilers. VNC is an efficient cross-platform remote desktop system that gives better performance than X over long distances. SSH is used under VNC to increase security and to get through many firewalls, since the SSH port is usually open. SSH can also be used to route a VNC connection through a gateway machine if the final destination is not directly accessible.
Do not run simulations via a GUI. Only use VNC for software development and setting up jobs if the GUI is too memory-intensive to run on your desktop.
At this time, VNC is only available on Magnus and Galaxy.
You only need to do this once on each remote system where you will run VNC.
SSH to the cluster where you will run VNC.
- Run "vncpasswd" to set up a password for your VNC server. The password is independent of your login password, and should be different to your regular Pawsey password.
Create and open a startup file "xstartup" under the directory: ~/.vnc/
Insert the following contents in the xstartup file:
Make sure the xstartup file you created is executable:
On starting, this will run a single xterm and the icewm-lite window manager.
Do not use GNOME via VNC. Being relatively slow and memory-inefficient, GNOME is a poor choice in this application.
Starting the VNC Server
- SSH to the cluster where you will run VNC.
Start the VNC Server by typing "vncserver". Note the hostname and DISPLAY number, in this case magnus-1 and 4 respectively. You will also need to know the port number, which is calculated by adding 5900 to the display number. In the example below the DISPLAY# is 4, meaning the port number is 5904.
You should note the hostname of where you started VNC, since it might be different next time you log in (e.g. Magnus has 2 login nodes, magnus-1 and magnus-2). You also need to know the hostname for tunnelling VNC over SSH.
- You can log out of the machine once VNC is started, or just stay logged in so that you can stop VNC when finished. The default size for the VNC desktop is 1024×768 pixels. This can be changed using the -geometry option – if one plans to run on a smaller laptop screen or a large workstation screen. For example, vncserver –geometry 1280x1024.
- You can log out of the machine once VNC is started, or just stay logged in so that you can stop VNC when finished.
Stopping the VNC Server
You need to know the hostname and display number of your VNC Server. You should have noted this when you started the VNC Server. Use vncserver -kill :DISPLAY# to stop the VNC Server. E.g. vncserver -kill :4. If you log out without killing the VNC Server, then you can ssh back in to the correct machine and stop it.
Connecting to VNC from Windows
MobaXterm is significantly easier to use than PuTTY with a standalone VNC client. To use a VNC client with PuTTY, follow the instructions for Linux/Mac below for creating a SSH tunnel.
In MobaXterm, start a “New session” from the “Sessions” tab. Select VNC.
For the Remote hostname enter the hostname that you started VNC on. E.g. magnus-1. The port number to enter is 5900+N, where N is the DISPLAY number.
Tick the box to connect via a SSH gateway. Enter the full name of the gateway, such as magnus.pawsey.org.au. Enter your username, and leave the port at 22.
After you click OK, you will be asked for one or two passwords. The dialog box for “vncuser” on “localhost” refers to the password set when you ran vncpasswd. The other password prompt, if it appears, is for your account on the SSH gateway. If you use a SSH key and have already entered your passphrase, then this prompt may not appear.
If the MobaXterm VNC session does not automatically open an SSH tunnel, open a Shell (Terminal) session and type the following at the prompt, reflecting your VNC Server host, port number and username, similar to:
Once the tunnel is open, create a VNC session and enter 'localhost' as the the 'Remote hostname or IP address' and leave '5900' as the default 'Port'. Click 'OK'.
Connecting to VNC from Windows with PuTTY and a VNC Client
SSH Tunnel with PuTTY
In PuTTY (this can be a new PuTTY instance or an existing session on the gateway machine), open up the tab Connection > SSH > Tunnels. Enter the source port as 5900, and the destination from when you started the VNC Server. The destination port is 5900+N, where N is the DISPLAY number. For example, type magnus-1:5904 if the display number is 4. Click the Add button.
If this is the PuTTY instance for the gateway machine, select Apply, then proceed to the next step (that is, starting the VNC client). If this is a new PuTTY instance, then switch to the Session tab and enter the hostname of the gateway machine. Click the open button. It will prompt you for a username and password, which corresponds to your account on the gateway machine.
In your VNC client, use localhost and do not specify a port number (it defaults to 5900).
If your VNC client warns about unencrypted traffic, you can safely ignore this since it is getting tunnelled over SSH.
The password that your VNC client will ask for is the password entered into vncpasswd.
Connecting to VNC from Linux/Mac
On these systems the SSH tunnel is set up separately to the VNC client.
Set up the SSH tunnel via command line. host is the name of the system you are running VNC Server on, and hostport is the corresponding port. The localport will almost always be 5900. The remote port will be 5900+N where N is the DISPLAY number from starting vncserver. username is your account name on gatewayhost. If you are prompted for a password then this is for username@gatewayhost.
Once the SSH tunnel is running, run your VNC client following the instructions in the VNC Client with PuTTY section above.
Using the Remote System
Use the XTerm as a terminal to launch your GUI application. In the following subsections some examples are provided.
You can spawn additional XTerms by right-clicking within the window manager.
In the xterm, type:
Other GUI software
Run memory-intensive or cpu-intensive GUI software on a compute node, not a login node. From an Xterm within the VNC session, request an interactive session with X-forwarding on a compute node using salloc. E.g. (with substituting your project in place of pawsey0123)