VPS on Linux with GUI: Running X2Go Server on Ubuntu 18.04



We have already mastered the VNC and RDP configuration on the virtual server, it remains to explore one more option for connecting to a virtual Linux desktop. The capabilities of NoMachine's NX protocol are interesting enough, and it works well over slow links. Proprietary server solutions are expensive (client solutions are free), but there is also a free implementation, which will be discussed in this article - the X2Go system . It spun off from the open source project FreeNX when NoMachine stopped supporting it and set it free.



Table of contents:





Installing a graphical environment



For a virtual graphical desktop on Linux, powerful machines are not needed until the user starts running applications. For our tests, we'll take a solid middling Ubuntu Server 18.04 LTS with two processing cores, four gigabytes of RAM and a twenty gigabyte hard disk drive (HDD). Ubuntu Server 20.04 LTS images are already available on RuVDS, the setup process for a more recent version will be the same. Don't forget to use the promo code Habrahabr10 to get a 10% discount when ordering.







We again use XFCE as the desktop environment due to the relatively low requirements for computing resources. In addition, there are no problems with launching this DE via remote access in virtual environments:



sudo apt-get install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils


Server Russification and software installation



The next step is to set up localization and install a minimal set of applications: a browser, an email client and an office suite. First, we install translations for system programs:



sudo apt-get install language-pack-ru


Let's set up localization:



sudo update-locale LANG=ru_RU.UTF-8


You can achieve the same effect by manually editing the / etc / default / locale.



To localize GNOME and KDE, the repository contains language-pack-gnome-ru and language-pack-kde-ru - you will need them if you will be using programs from these desktop environments. In XFCE, translations are installed along with the applications. Then 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


In addition, the installation of 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 X2Go Server



Stable versions of the X2Go server and client can be installed from the external PPA (Personal Packages Archive) repository on Launchpad or from the regular Ubuntu release repositories. We will focus on the second option, since the software versions in both sources are the same, but if you need additional packages, you will have to connect a third-party repository. We need to install two packages:



sudo apt-get install x2goserver x2goserver-xsession


If you are using MATE or LXDE environment, additional packages are required (for XFCE they are not needed):



sudo apt-get install x2gomatebindings # if you use MATE/mubuntu
sudo apt-get install x2golxdebindings # if you use LXDE/lubuntu


Cherry on the cake: X2Go works over SSH and does not need any further configuration. The VPS must be running sshd and accessing port 22 in the firewall rules. Since we are talking about a virtual server, this is probably already done out of the box. Opening remote SSH access on a physical machine is not difficult. It remains only to check the status of the X2Go server:



sudo systemctl status x2goserver




It is also worth creating an unprivileged user to work with the desktop environment:



sudo adduser desktopuser




Add the user to the sudo group so that he can solve administration-related tasks. If there is no such need, you can skip this step:



sudo gpasswd -a desktopuser sudo


Desktop connection



X2Go client software for Windows, Linux and OS X can be downloaded from the project website . An Android client is under development, and the free mobile apps from NoMachine are not compatible with the X2Go server. If you have Ubuntu installed on your local computer, just add the x2goclient package:



sudo apt-get install x2goclient


To preserve species diversity, this time we will take a client for Windows :





Here you can configure the settings for the connection, I / O devices, and multimedia devices.









If done correctly, the XFCE desktop will appear after connecting.





Running an application on a remote computer



Sometimes, instead of a full-fledged desktop environment on a remote computer, you need to run a resource-intensive application (for example, an IDE). It is not difficult to do this, it is enough to 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 options for using X2Go: the system allows, for example, connecting to a user's session on a remote computer (as in TeamViewer). In this case, both the client and server parts must be installed on both machines. In addition, it is not necessary to define session profiles on each client: you can install and configure x2gobroker to define them on the server. To do this, you will have to connect a third-party repository with additional packages.



X2Go benefits



Unlike the high bandwidth VNC system, X2Go uses the advanced NX 3 protocol to minimize the amount of data transferred. The system has its own X-server, moreover, it requires almost no configuration and has advanced features. We've covered only the most basic ones, but X2Go can do a lot more, including broadcasting audio and video from the server to the client, printing to a local printer (you will have to install additional packages on the VPS to set up a virtual printer) and shared directories. Interaction with the server goes through a reliable and time-tested sshd - secure authentication mechanisms are available to the user, incl. with keys. X2Go automatically configures the environment upon login (you don't need to keep the X server running all the time),it supports multi-user work and most popular desktop environments, and the session is not killed even after the connection is broken.






All Articles