How to set up remote desktop on Linux VPS using x2go

Last updated on September 19, 2020 by Dan Nanni

As everything is moved to the cloud, virtualized remote desktop becomes increasingly popular in the industry as a way to enhance employee's productivity. Especially for those who need to roam constantly across multiple locations and devices, remote desktop allows them to stay connected seamlessly while preserving their work environment. Remote desktop is attractive for employers as well, achieving increased agility and flexibility in work environments as well as lowering IT cost from hardware consolidation and desktop security hardening.

In the world of Linux, of course there is no shortage of choices for settings up remote desktop environment, with many protocols (e.g., RDP, RFB, NX) and server/client implementations (e.g., TigerVNC, RealVNC, FreeNX, x2go, X11vnc, TeamViewer) available.

Standing out from the pack is X2Go, an open-source (GPLv2) implementation of NX-based remote desktop server and client. In this tutorial, I am going to demonstrate how to set up remote desktop environment for Linux VPS using X2Go.

What is X2Go?

The history of X2Go goes back to NoMachine's NX technology. The NX remote desktop protocol was designed to deal with low bandwidth and high latency network connections by leveraging aggressive compression and caching. Later, NX was turned into closed-source while NX libraries were made GPL-ed. This has led to open-source implementation of several NX-based remote desktop solutions, and one of them is X2Go.

What benefits does X2Go bring to the table, compared to other solutions such as VNC? X2Go inherits all the advanced features of NX technology, so naturally it works well over slow network connections. Besides, X2Go boasts of an excellent track record of ensuring security with its built-in SSH-based encryption. No longer need to set up an SSH tunnel manually. X2Go comes with audio support out of box, which means that music playback at the remote desktop is delivered (via PulseAudio) over network, and fed into local speakers. On usability front, an application that you run on remote desktop can be seamlessly rendered as a separate window on your local desktop, giving you an illusion that the application is actually running on the local desktop. As you can see, these are some of its powerful features lacking in VNC based solutions.

X2Go's Desktop Environment Compatibility

As with other remote desktop servers, there are known compatibility issues for X2Go server. Desktop environments like KDE3/4, Xfce, MATE and LXDE are the most friendly to X2Go server. However, your mileage may vary with other desktop managers. For example, the later versions of GNOME 3, KDE5, Unity are known to be not compatible with X2Go. If the desktop manager of your remote host is compatible with X2Go, you can follow the rest of the tutorial.

Install X2Go Server on Linux

X2Go consists of remote desktop server and client components. Let's start with X2Go server installation. I assume that you already have an X2Go-compatible desktop manager up and running on a remote host, where we will be installing X2Go server.

Note that X2Go server component does not have a separate service that needs to be started upon boot. You just need to make sure that SSH service is up and running.

For Ubuntu or Linux Mint:

Configure X2Go PPA repository. X2Go PPA is available for Ubuntu 14.04 and higher.

$ sudo add-apt-repository ppa:x2go/stable
$ sudo apt-get update
$ sudo apt-get install x2goserver x2goserver-xsession

For Debian (Wheezy):

$ sudo apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E
$ sudo sh -c "echo deb http://packages.x2go.org/debian wheezy main > /etc/apt/sources.list.d/x2go.list"
$ sudo sh -c "echo deb-src http://packages.x2go.org/debian wheezy main >> /etc/apt/sources.list.d/x2go.list"
$ sudo apt-get update
$ sudo apt-get install x2goserver x2goserver-xsession

For Fedora:

$ sudo yum install x2goserver x2goserver-xsession

For CentOS or RHEL:

Enable EPEL respository first, and then run:

$ sudo yum install x2goserver x2goserver-xsession

Install X2Go Client on Linux

On a local host where you will be connecting to remote desktop, install X2GO client as follows.

For Ubuntu or Linux Mint:

Configure X2Go PPA repository. X2Go PPA is available for Ubuntu 14.04 and higher.

$ sudo add-apt-repository ppa:x2go/stable
$ sudo apt-get update
$ sudo apt-get install x2goclient

For Debian (Wheezy):

$ sudo apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E
$ sudo sh -c "echo deb http://packages.x2go.org/debian wheezy main > /etc/apt/sources.list.d/x2go.list"
$ sudo sh -c "echo deb-src http://packages.x2go.org/debian wheezy main >> /etc/apt/sources.list.d/x2go.list"
$ sudo apt-get update
$ sudo apt-get install x2goclient

For Fedora:

$ sudo yum install x2goclient

For CentOS or RHEL:

Enable EPEL respository first, and then run:

$ sudo yum install x2goclient

Connect to Remote Desktop with X2Go Client

Now it's time to connect to your remote desktop. On the local host, simply run the following command or use desktop launcher to start X2Go client.

$ x2goclient

Enter the remote host's IP address and SSH user name. Also, specify session type (i.e., desktop manager of a remote host).

If you want, you can customize other things (by pressing other tabs), like connection speed, compression, screen resolution, and so on.

When you initiate a remote desktop connection, you will be asked to log in. Type your SSH login and password.

Upon successful login, you will see the remote desktop screen.

If you want to test X2Go's seamless window feature, choose Single application as session type, and specify the path to an executable on the remote host. In this example, I choose Dolphin file manager on a remote KDE host.

Once you are successfully connected, you will see a remote application window open on your local desktop, not the entire remote desktop screen.

Conclusion

In this tutorial, I demonstrated how to set up X2Go remote desktop on Linux VPS instance. As you can see, the whole setup process is pretty much painless (if you are using a right desktop environment). While there are some desktop-specific quirkiness, X2Go is a solid remote desktop solution which is secure, feature-rich, fast, and free.

What feature is the most appealing to you in X2Go? Please share your thought.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin (1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g).

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean