Configuration and on the virtual server has already been mastered, there's just one more way to connect to the Linux virtual desktop to explore. The capabilities created by the company protocol are quite interesting, and it works well even over slow connections. The proprietary server solutions are expensive (client versions are free), but there is also a free implementation that we will discuss in this article — the system . It branched off from the open-source project , when NoMachine ceased its support and let it go on its own.
Table of Contents:
Installing the Graphical Environment
For a virtual graphical desktop on Linux, powerful machines aren't required until the user starts launching applications. For testing, we'll take a solid mid-range server with Ubuntu Server 18.04 LTS featuring two computing cores, four gigabytes of RAM, and a twenty-gigabyte hard drive (HDD). Images of Ubuntu Server 20.04 LTS are already available on RuVDS, and the setup process for the newer version will be similar. Don't forget to use the promo code Habrahabr10 for a 10% discount on your order.

For the desktop environment, we're again using XFCE due to its relatively low resource requirements. Additionally, there are no issues with running this DE over remote access in virtual environments:
sudo apt-get install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
Localizing the Server and Installing Software
In the next step, you should set up localization and install a minimal set of applications: a browser, an email client, and an office suite. First, we'll install translations for the system applications:
sudo apt-get install language-pack-ruLet's set the localization:
sudo update-locale LANG=ru_RU.UTF-8The same effect can be achieved by manually editing the file /etc/default/locale.
For localizing GNOME and KDE, there are packages in the repository: language-pack-gnome-ru and language-pack-kde-ru — you will need them if you use programs from these desktop environments. In XFCE, translations are installed along with the applications. Next, you can install dictionaries:
# Словари для проверки орфографии
sudo apt-get install hunspell hunspell-ru
# Тезаурус для LibreOffice
sudo apt-get install mythes-ru
# Англо-русский словарь в формате DICT
sudo apt-get install mueller7-dict
Additionally, installing translations may be required for some applications:
# Браузер Firefox
sudo apt-get install firefox firefox-locale-ru
# Почтовый клиент Thunderbird
sudo apt-get install thunderbird thunderbird-locale-ru
# Офисный пакет LibreOffice
sudo apt-get install libreoffice libreoffice-l10n-ru libreoffice-help-ru
На этом подготовка окружения рабочего стола завершена.
Installing the X2Go server
Stable versions of the X2Go server and client can be installed from an external repository (Personal Packages Archive) on or from the standard repositories of current Ubuntu releases. We'll focus on the second option since the software versions in both sources are the same, but if you need additional packages, you'll have to connect to the third-party repository. We need to install two packages:
sudo apt-get install x2goserver x2goserver-xsessionIf you are using the MATE or LXDE environments, additional packages will be required (they are not needed for XFCE):
sudo apt-get install x2gomatebindings # if you use MATE/mubuntu
sudo apt-get install x2golxdebindings # if you use LXDE/lubuntu
The cherry on top: X2Go operates via SSH and requires no further configuration. The VPS must have sshd running and port 22 open in the firewall rules. Since this is about a virtual server, this is likely already set up out of the box. On a physical machine, enabling remote SSH access is straightforward. Just verify the status of the X2Go server:
sudo systemctl status x2goserver 
It's also a good idea to create a non-privileged user for working with the desktop environment:
sudo adduser desktopuser 
We will add the user to the sudo group so that he can perform administrative tasks. If there is no need for this, this step can be skipped:
sudo gpasswd -a desktopuser sudo
Connecting to the desktop
The X2Go client software for Windows, Linux, and OS X can be to project. The Android client is under development, and free mobile applications from NoMachine are incompatible with the X2Go server. If Ubuntu is installed on the local computer, simply add the x2goclient package:
sudo apt-get install x2goclientTo maintain visual variety this time, we will use the client for :

Here you can configure connection settings, input/output devices, and multimedia devices.



If everything is done correctly, an XFCE desktop will appear after connection.

Launching applications on a remote computer
Sometimes, instead of a full desktop environment on the remote computer, you need to launch a resource-intensive application (like an IDE). This is easy to do; just specify the appropriate session type and command in the connection settings.


The browser is running on a remote VPS with Ubuntu
There are also more exotic uses for X2Go: the system allows you to connect to a user's session on a remote computer (similar to TeamViewer). In this case, both machines need to have both client and server parts installed. Additionally, it is not necessary to define session profiles on each client: you can install and configure x2gobroker to define them on the server. For this, you will need to connect with additional packages.
Advantages of X2Go
Unlike VNC systems that require a high bandwidth channel, X2Go uses the advanced NX 3 protocol to minimize data transfer. It has its own X server, requires minimal setup, and offers advanced features. We've only covered the basics, but X2Go is capable of much more, including streaming audio and video from the server to the client, printing to a local printer (you'll need to install additional packages on the VPS for virtual printer setup), and shared directories. Interaction with the server occurs through a reliable, time-tested sshd — users have access to secure authentication mechanisms, including key-based authentication. X2Go automatically configures the environment upon login (there's no need to keep the X server running constantly), supports multi-user operation, and works with most popular desktop environments, while sessions are not terminated even after the connection is lost.
Source: habr.com
