How to Set Up a Remote Desktop with X2Go on CentOS 8

X2Go is an open-source remote desktop software for Linux that uses a modified NX 3 protocol. X2Go gives remote access to a Linux system's graphical user interface.

This guide uses X2Go to create an CentOS 8 XFCE desktop environment that can be easily accessed remotely.

Prerequisites

  • A running CentOS server with 2GB RAM or more is recommended.

  • User with sudo privileges.

To set up a Remote Desktop using X2Go on CentOS 8, follow the steps below:



Step 1 - Install the Desktop Environment on your Virtual Machine/Instance

Firstly, you need to update all software packages on your instance. Use the following command:

sudo dnf upgrade

The desktop environment is installed on top of the operating system as software that makes the interface more user-friendly. You can choose and install any of the environments such as XFCE, LXDE, MATE Desktop, KDE Plasma Desktop, or more.

If you want to install a different environment for example KDE, then you will require to replace a command,

sudo dnf groupinstall Xfce with sudo dnf group install "KDE Plasma Workspaces"

Next, you need to configure Session Type in X2Go client to KDE.

Note:You can install a number of environments together with each other and choose your preferable environment every time you log in with your X2Go client.

The software packages you want to install now are not contained in CentOS’ default repositories, so to enable the extra packages for enterprise Linux (EPEL) repositories, use the following command:

sudo dnf install epel-release

Few X2Go server utilities depend on some packages found in the PowerTools repository. Use the following command to enable it.

sudo dnf config-manager --set-enabled powertools

To install the XFCE desktop environment, use the following command:

sudo dnf groupinstall Xfce

CentOS provides a minimal XFCE environment. However, you can add utilities such as browsers, image editors, and more by using the below command:

sudo dnf install name_of_application

As the desktop environment is installed, now you need to establish a way to view it on your local machine.

Step 2 — Install X2Go on your Virtual Machine

X2Go has two components, the X2Go Server – it gets installed on the computer or virtual machine you want to remote control and helps manage the graphical session on the remote machine. The X2Go Client gets installed on the computer or your local machine from which you want to remote control and view the remote application.

sudo dnf install x2goserver

Step 3 — Install the X2Go Client on your Local Machine

After installing the X2Go server on your virtual machine, you need to install the X2Go client on your local machine. To download the X2Go client, click here

If you are using Debian 10 use the below command to install the X2Go client.

sudo apt-get install x2goclient

Step 4 — Connect to the Remote Desktop

When you open the X2Go client the first time, you would see the following window. If you don’t see it, create a new session by clicking Session and then selecting New Session.

To connect to the Remote Desktop, follow the steps below:

  1. Provide the name in the Session name field.

  2. Enter your virtual machine’s IP address or hostname in the Host field.

  3. Enter the username you used for your SSH connection in the Login field.

  4. Since XFCE is installed as the desktop environment, choose XFCE as your Session type.

  5. Enter the SSH port (by default, it is 22).

  6. Click Folder icon next to Use RSA/DSA key for ssh connection and browse your private key.

  7. Note: If you did not choose to use the SSH keys, you could skip this. However, the X2Go client will always ask for the password every time you log in.

  8. Click Ok to save the configuration.

To get started with your graphical session, click the white box and enter your Login and Password.

As your remote desktop appears, you can start accessing it and get your work done.