Skip to main content

[Archive] How to use a Graphical User Interface (GUI) on a Virtual Machine?

Let's see how to install and use a Graphical User Interface on a WEkEO instance.

Written by David Bina

Context


The WEkEO DIAS offers the possibility for end-users to launch Instances (Virtual Machines) within a complete and independent cloud infrastructure. To learn how to launch an instance on WEkEO, please check How to launch an instance (Virtual Machine) on WEkEO?

You can access your virtual machines via a Command Line Interface (CLI) which is the default method, but you can also connect to a VM via a Graphical User Interface (GUI).

First of all, you need to install a graphical environment in your virtual machine. We recommend to use XFCE (we will take it for the purpose of this article).

Then, to access the Graphical User Interface (GUI) of your virtual machine, you can use programs that will allow you to connect to your machine with graphic access.

We will show here two possibilities:

⚠️ WARNING⚠️

You need to open ports on the VM you want to access via GUI:

  • X2Go: port 22

  • xrdp: port 3389

To open a port, you can add a rule in the security group going on Infrastructure > Networks > Security Groups, click on the relevant group then +ADD RULE.

Here is an example to fill in the form for the xrdp method:

Install a graphical desktop environment on the VM


To install the selected graphical desktop environment on your VM, you must first connect to the machine via SSH. You can do it by following the command below:

ssh -i <ssh_private_key> <username>@<ip_host_machine>

  • ssh_private_key: path to the SSH private key for access to the VM

  • username: you can use the username per user or per tenant. Remember to choose the configuration key for specific users

  • ip_host_machine: VM public IP address

Take a look at this demonstrative command:

ssh -i user user@185.213.75.143

Install XFCE

To install XFCE for Ubuntu, run the following commands:

sudo apt update

sudo apt install xfce4

To install XFCE for CentOS, run the following commands:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum groupinstall "Xfce" -y

📌 Note: during the installation of XFCE, you might encounter this message:

You can select gdm3 or lightdm with the arrow keys and press Enter.

Access the VM via X2Go


Step 1. Install X2Go server

First we need to install a SSH-tunneling Remote Desktop solution on the VM.

On Ubuntu, run the following commands:

sudo apt install software-properties-common

sudo add-apt-repository ppa:x2go/stable

sudo apt update

sudo apt install x2goserver x2goserver-xsession

On CentOS, run the following command:

sudo yum install x2goserver-xsession -y

Step 2. Install X2Go client

Once the server is installed on the VM, we can access it by running a client we need to install on the local computer.

For Windows:

For Ubuntu:

sudo apt install x2goclient

For CentOS:

sudo yum install x2goclient -y

Step 3. Configure and launch X2Go

To run X2Go, double click on the executable file on Windows or execute this command in a terminal: x2goclient

The following window will appear:

To create a new session, click on Session in the top menu.

Fill in the form with the following:

  • Session name: name of your session (e.g. XFCE)

  • Host: floating IP of the virtual machine

  • Login: your username

  • SSH port: 22: leave unchanged to connect via SSH

  • Use RSA/DSA key for ssh connection: put your SSH private key

  • Session type: choose a pre-installed graphic theme (XFCE)

Configuration example:

You can change display mode in Input/Output tab:

Click OK.

Be sure to select XFCE as the GUI:

Click on the tile to connect to the machine with GUI:

Access the VM via xrdp


Step 1. Install xrdp server

First we need to install the xrdp server on the VM.

On Ubuntu, run the following commands:

sudo apt-get update

sudo apt-get -y install xrdp

sudo systemctl enable xrdp

sudo adduser xrdp ssl-cert

echo xfce4-session >~/.xsession

sudo service xrdp restart

We also need to install an ssh server:

sudo apt-get install openssh-server

Provide your password and say "yes" when asked.

Step 2. Configure the SSH connection

On Windows, we will configure the SSH connection with PuTTY.

When you open PuTTY, the session canvas opens where you can fill in the form:

  • Host Name: IP address of the VM

  • Port: 22

  • Connection type: SSH

  • Saved Sessions: name for that session

Then we need to configure the SSH tunnel.

On the left menu, expand SSH and click on Tunnels and provide:

  • Source port: 5555 (or any port available on your windows system)

  • Destination: 127.0.0.1:3389 (the port 3389 is the default xrdp port)

Click on Add. It should look like this:

Now go back to the Session canvas and click on Save:

With this configuration saved, you won't need to repeat all these steps in the future.
From now on, you can Load this configuration.

Step 3. Open the SSH connection

Once it is selected, click on Open to open the SSH connection:

📌 Note: Only the first time, you will have to accept the connection:

Then you just have to provide your username and password to connect to the VM:

Let this window opened until your deconnect from the VM.

Step 4. Connect to the VM GUI via xrdp

Now that you are connected via SSH on your VM, you can use xrdp to access your VM via a graphical interface.

On Windows

Open the Remote Desktop (pre-installed on Windows machines), type "localhost:5555" in the Computer field and click on Connect:

A new window will open. Enter your VM credentials:

If credentials are correct, you will reach your VM via the XFCE GUI:

And voilààà! You have access to your instance via a Graphical User Interface 😃

What's next?


After installing a Graphical User Interface on your WEkEO virtual machines, you are more than ready to download WEkEO data! Here are some articles that could be helpful on the subject:

We are user-driven and we implement users' suggestions, so feel free to contact us:

  • through a chat session available in the bottom right corner of the page

  • via e-mail to our support team (supportATwekeo.eu)

Did this answer your question?