Setting up a GUI Desktop on a VM¶
Some software that you can install on your virtual machine (VM, or instance) are only, or best accessed, through their graphical user interface (GUI). It is possible to use a GUI through SSH + X11 forwarding. However, you may observe better performance when using VNC to connect to a remote desktop running on your VM.
Below, we outline steps for setting up a remote desktop with VNC.
Note
These instructions are for a VM running a Ubuntu operating system.
1. Install a GUI Desktop on Your VM¶
There are lots of different Desktop packages available. For example, some common Desktop packages available for the Ubuntu operating system are: * ubuntu-unity-desktop * ubuntu-mate-desktop * lubuntu-desktop * xubuntu-desktop * xfce4 * ubuntu-desktop * kde-plasma-desktop * ubuntu-desktop-minimal * cinnamon * icewm
This article shows a few of these different desktops. Below are the commands to install the MATE desktop.
During the installation of the ubuntu-mate-desktop package, it will ask you to choose the default display manager; a good option is lightdm. Installing the ubuntu-mate-desktop package can take a fair amount of time (something like 15-30 minutes).
2. Install TigerVNC Server¶
This software runs on your VM and allows you to use the GUI desktop you installed in step 1 remotely using client software.
This command will install the TigerVNC server and some supporting software. For details about using VNC servers and clients, see our documentation on VNC.
3. Start the VNC Server¶
When you runvncserver for the first time, you will be prompted to set a password. This password is used later when connecting to the VNC desktop. You do not need a view-only password. The vncpasswd command can later be used to change your password.
4. Test Your Connection¶
To test your connection, you can open port 5901 (see security groups for more information about opening ports to your VMs with OpenStack) and connect using a VNC viewer, for example TigerVNC.
Insecure Connection
This is not a secure connection; data sent to and from your VM will not be encrypted. This step is only meant to test your server-client connection before connecting securely with an SSH tunnel (the next step). If you are confident in your ability to set up an SSH tunnel, you may skip this step.
5. Connect Using an SSH Tunnel¶
See SSH tunnelling for general information. There is an example of creating an SSH tunnel to a VNC server running on a compute node of one of our clusters.
Below are instructions for connecting using an SSH tunnel for Linux or macOS: 1. Open your terminal. 2. Type the following in your local terminal:
3. Start your VNC viewer. 4. In the VNC server field, enter:localhost:5901.
5. Your GUI desktop for your remote session should now open.
6. Close Port 5901¶
Security Recommendation
Once you are connected to your VNC server using an SSH tunnel, you no longer require port 5901 to be open. It is recommended that you remove this rule from your security groups (see security groups for more information).
7. Stop the VNC Server¶
Once you are finished using the remote desktop, you may stop the VNC server with:
```bash vncserver -kill :1