How to set up remote desktop on Linux VPS using x2go

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.

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

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

Fedora:

$ sudo yum install x2goserver x2goserver-xsession

CentOS/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.

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

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

Fedora:

$ sudo yum install x2goclient

CentOS/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.


Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

8 thoughts on “How to set up remote desktop on Linux VPS using x2go

  1. X itself is a built as a networked user interface, so I never understood why people tried to use VNC and other remote desktop solutions on top of that.

    Seems most are not aware of just how network enabled X is from the ground up.

    • Network transparency of X11 does not automatically mean we should use it. The X11 protocol is quite low level and too chatty to be efficient over network.

  2. On the X2GO session configuration in the Connection section it is useful to understand that sliding the speed toward modem tells x2go to implement greater compression... sliding toward LAN tells it to use less compression. So depending on your CPU and your internet speed you might want to experiment a bit to see where you get best results.

    Also, x2go does have a Python Client called PyHoca. I am not a ChromeOS user but if it supports Python there is a chance you may be able to get it to work for you but be aware there may be some s/w dependencies it may need that ChromeOS doesn't use/have.

    The x2go connection between client/server is also encrypted so that too is good to understand.

    x2go is probably the fastest remote desktop I've tried by far and I've tried teamviewer, guacamole, vnc, and many others over time.

    There is a very active developer and user community also which is nice to know. It also supports screen sharing, session restart, audio, remote printing, file shares etc.

    Brian

  3. Hi Dan!
    Do you try to use different keyboard, not "en" ?
    I think X2GO very good tool, but I try to connect from my mac to linux with xfce and my keyboard doesn't work (I can connect from windows and my keyboard works, but I can't change it from my linux server ...

Leave a comment

Your email address will not be published. Required fields are marked *