How to Connect to a Cluster using VNC

As an alternative to X11 Forwarding, using VNC to access the cluster is another way to run graphically intensive applications.

  1. Connect to the cluster with X11 forwarding enabled. If on Linux or Mac, ssh -Y netid@cluster, or if on Windows, follow our X11 forwarding guide.

  2. Start an interactive job on cluster with the --x11 flag (see Slurm for more information). For this description, we’ll assume you were given node c04n03:

    srun --pty --x11 -p interactive bash
  3. On that node, run the VNCserver. You’ll see something like:

    c04n03$ vncserver
    New 'c31n02.grace.hpc.yale.internal:1 (kln26)' desktop is c31n02.grace.hpc.yale.internal:1
    Creating default startup script /home/fas/hpcprog/kln26/.vnc/xstartup
    Starting applications specified in /home/fas/hpcprog/kln26/.vnc/xstartup
    Log file is /home/fas/hpcprog/kln26/.vnc/c31n02.grace.hpc.yale.internal:1.log

    The :1 means that your DISPLAY is :1. You’ll need that later, so note it. The first time you run "vncserver", you’ll also be asked to select a password for allowing access.

  4. From a shell on your local desktop, run the following ssh command:

    ssh -Y -L7777:c04n03:5901 YourNetID@cluster_login_node

    This will set up a tunnel from your local port 7777 to port 5901 on c04n03. You will need to customize this command to your situation. The 5901 is for display :1. In general, you should put 5900+DISPLAY. The 7777 is arbitrary; any number above 3000 will likely work. You’ll need the number you chose for the next step.

  5. On your local machine, start the vncviewer application. Depending on your local operating system, you may need to install this. Most linux and mac computers should already have it. On newer MacOS, you may need to install a viewer, in which case we recommend TurboVNC On Windows, install and use the "tightvnc" viewer program. You can find either of these programs via Google.

    When you start the viewer, you’ll need to tell it which host and port to attach to. You want to specify the local end of the tunnel. In the above case, that would be localhost::7777. Exactly how you specify this will depend a bit on which viewer you use. E.g:

    $ vncviewer localhost::7777

    You should be prompted for the password you set when you started the server.

  6. Now you are in a GUI environment and can run IGV or any other rich GUI application.

  7. When you are all finished, you can kill the vncserver by doing this in the same shell you used to start it (replace :1 by your display number):

    $ vncserver -kill :1