How to Set Up a Remote Desktop with X2Go on Debian 9

Nowadays, Windows Servers are the norm when talking about Remote Desktop Connection. The great thing is that you don’t have to be locked into just using Windows when wanting to control a server via Remote Desktop.

You can easily get a Linux server, running Ubuntu/Debian/Centos, and install a desktop environment on it and a remote desktop package, and a way you go. On top of that, Linux servers are a lot more lightweight and a lot cheaper too!

Some of the most popular remote desktop solutions for Linux are VNC, xRDP or NoMachine. Although these are great solutions, I find them lacking. I’m not saying they’re not good, it’s just that in my experience they’ve been either sluggish or buggy – maybe I’m wrong.

If you’d prefer to use Ubuntu 18.04 instead of Debian 9, you can check out our tutorial on how to Install X2Go on Ubuntu 18.04


What I have found, however, to be a great solution for Remote Desktop Connection on Linux (in our current case, Debian 9) is X2Go.

As I’ve mentioned in our other tutorial on how to install and use X2Go on Ubuntu 18.04, I don’t know why X2Go isn’t more popular.

It’s easy to set up and it provides an super smooth experience. I admit, sometimes, depending on the OS, it’ll give me some trouble installing it. But I’ve been using it for years and haven’t found a better alternative.

Right, let’s get to installing X2Go on Debian 9.


  • While not required, it is recommended that you’re acting as a non-root sudo user.
  • A server running Debian 9. We recommend a minimum of 2GB RAM, but it would be even better with 4GB+ RAM.

NOTE: The following steps in this tutorial will assume that you have a sudo user set up on Debian 9, as such, the commands will contain sudo at the beginning. If you insist on acting as root, then simply run the commands without sudo at the beginning of the commands.

Step 1 – Install X2Go on Debian 9

First of all we’d have to add the X2Go Repository GPG Keys, but we’d most likely encounter an error from Debian 9. Although it provides a fully operational gnugpg command in the minimal installation, it still requires dirmngr to perform network operations for managing and downloading certificates. As such, we’ll first have to install dirmngr:

$ sudo apt install dirmngr 

Now we can add the X2Go Repository GPG Keys to our system:

$ sudo apt-key adv --recv-keys --keyserver E1F958385BFE2B6E

Next, we’ll add the X2Go repositories. To do this, we’ll open the file /etc/apt/sources.list.d/x2go.list using our favorite text editor, and we’ll add the X2Go Repository.

I’ll use nano to open the file:

$ nano /etc/apt/sources.list.d/x2go.list

And add the following lines in the file:

deb stretch extras main
deb-src stretch extras main

Save and close the file when you’re done.

Finally, run the following command to install X2Go on your server:

$ sudo apt-get install x2goserver x2goserver-xsession

Step 2 – Install Your Preferred Desktop Environment

You can use multiple desktop environments. All you have to do is have them installed, and you’ll be able to select which one you want to use, when connecting to the server via X2Go.

In this tutorial we’ll be installing and using 3 of them, which are among the most popular – XFCE, LXDE and MATE. There are quite a few more options, but some are resource intensive and some may not work with your current OS or the current X2Go version. What I’ve found is that XFCE, LXDE and MATE have always worked for me over the years.

It’s worth noting that XFCE and LXDE are among the most lightweight desktop environments, so they’re great for when you want a more resource-friendly solution.

We’ll also be installing Minimum Desktop Environment, which means that we’ll just install the core features, and you can install additional packages only if you need them.

Run one of the following commands to install your preferred desktop environment. You can also run all 3 if you want to have all of the desktop environments installed.

# Installing XFCE

$ sudo apt-get install xfce4

# Installing LXDE

$ sudo apt-get install lxde

# Installing MATE

$ sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Step 3 – Install X2Go on your Computer

Now that we’ve got our desktop environment installed, go ahead and download the X2Go client from their page at

  • For Windows look for the link to Windows installer
  • For OS X, depending on your version, look for OS X 10.xx and higher DMG

(The reason I’m not linking you directly is because there will be new releases, most likely, and this way you’ll get the latest versions when you’re working – through this tutorial)

  • If you’re on Debian or Ubuntu you can install X2Go Client by running the following command:
$ sudo apt-get install x2goclient

Step 4 – Connecting to the Remote Desktop

You can now run the X2Go client, that you’ve installed on your computer. The first time you run it, you should greeted with the following window, where you’re prompted to create your first session. If you don’t see this window, then you can create a new session by going in the top menu, in the upper left corner, and clicking on Session -> New Session.


In the Session name field you can name your session for ease of access. As you can see on the right, I’ve created multiple sessions to connect to the same VPS, and named them according to what desktop environment I’m using. It is not a vital thing for connecting to your VPS, it is just for your convenience.

In the Host field enter your server’s hostname or IP address.

In the Login field enter the user you used for your SSH connection.

In the Session type dropdown select the option that matches the desktop environment you installed. If you’ve followed our tutorial so far, you can select XFCE, LXDE or MATE, depending on which you chose to install on your server.

You can also change the session icon, by clicking on the baby seal image, where it says << change icon and then browsing to the image you want assigned.

Click OK to save the session.

With your session saved, you should now be able to click it, on the right of the X2Go window. A small prompt will appear where you’ll already have your user filled in. You’ll just have to enter your SSH password and confirm to connect.

It’ll take a few seconds to connect, and when it’s done you should see a window to your remote desktop, with the GUI of your selected desktop environment.

Here’s how each of the 3 desktop environments, that we’re testing out, look like:








Well done. You now should have a lightweight Debian Remote Desktop using X2Go, that’s always online, that’ll provide a smooth experience to get your work done.

Should you want more info on using X2Go, then do check out X2Go’s Official Documentation.

If you’ve had any issues at all, when following this tutorial, then don’t hesitate to let us know in the comments or by contacting us, and we’ll get back to you as soon as possible/

Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
5 years ago

X2Go client apparently can’t open a session as root, either using root’s password or certificate. Is there a way to enable root log-on?

× Dracula Servers

Subscribe to DraculaHosting and get exclusive content and discounts on VPS services.