Keep Your Desktop in the Cloud with X2Go on Debian 9


You will need at least 2GB of RAM on your instance to run a desktop environment comfortably. Even if lighter GUI applications can lower this requirement, using less than 2GB increases the likelihood of running into Out of Memory errors, which will force kill applications and might make you lose work progress unexpectedly.

Create an Alibaba ECS Instance

Log in to the ECS Cloud Console, create a new instance and choose Debian 9 as your Linux distribution.

Install X2Go Server

Upgrade all packages installed on your system:

apt update && apt upgrade
systemctl reboot
echo 'deb stretch extras main' > /etc/apt/sources.list.d/x2go.list
apt install dirmngr && apt-key adv --recv-keys --keyserver E1F958385BFE2B6E
apt update
apt install x2goserver x2goserver-xsession

Install a Desktop Environment

X2Go works with desktop environments like LXDE, XFCE and MATE, out of the box. Other environments like Gnome and Cinnamon either won’t work at all or they will require workarounds. Generally, whatever uses fancy graphics tricks like compositing windows and relies on the video card for processing the desktop in the 3D engine will have trouble with X2Go.

  1. Install a metapackage that automatically pulls in all packages required to build a minimal desktop environment. After the minimum requirements are installed, you can add whatever additional components you need (e.g., calculator utilities, code editors, browsers, etc.)
  2. Install a metapackage that automatically pulls in packages to build a complete desktop environment that will include all kinds of utilities the user might expect on a system, such as: text editors, browsers, PDF readers, image viewers, video players, music players, etc.
  3. Build your own desktop environment by installing all graphical components yourself, one by one. You can see a list of components required to build a desktop here:
apt install mate-desktop-environment
apt install task-mate-desktop

Create a Regular User

Logging in as root to a desktop session isn’t recommended. To create a regular user, enter the following command, replacing your_username with whatever name you prefer:

adduser your_username
su - your_username
Enter file in which to save the key (/home/your_username/.ssh/id_rsa):
cat .ssh/id_rsa
cp .ssh/ .ssh/authorized_keys

Install X2Go Client

At this point, you’re done with setting up the server. To connect to your remote desktop you will need to install a client application on your local computer. At the time of writing this tutorial, the link to the X2Go client for Windows was If the link becomes invalid, you can access the download page here: X2Go clients for OS X and Linux distributions are also available but since Windows is currently the most popular operating system, we will cover that here.

Set Up the Connection to Your Remote Desktop

  1. In the Host field fill in the public IP of your instance.
  2. In the Login field enter the username you’ve created in the previous step.
  3. On the line that says Use RSA/DSA key for ssh connection click on the browse icon on the far right and select the file where you have saved your SSH private key created in the previous section.
  4. Last, click on the dropdown list under Session type and select MATE as your desktop environment.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: