Whether you like to run a UI interface (X) on a Ubuntu server remotely for ease of management or you are a developer and would like to test your code on the same server where you develop your codes . You can just install a plain Ubuntu server with no GUI interface and run the X remotely at the client machine by using X2Go
With X2Go server, you can achieve a similar experience similar to Microsoft Windows Remote Desktop. Of course, you may already using something like VNC, however X2Go is much responsive than VNC Server. Let’s see how to get it going.
Install the Server
First, download and install the Ubuntu Server. As of today, the lastest LTS version for Ubuntu Server is 18.04.
Once the Ubuntu server is installed, log in, add a repository so that you can add more desktop related packages and then update the server.
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get upgrade
After the server finish update/upgrade, let’s reboot it.
Once the server finish rebooting, login again and install X2Go server and other desktop components and applications such as Firefox browser. The following commands also install the MATE Desktop which is the one I like. It is not too bulky and looks nice.
sudo apt-get install mate-core mate-desktop-environment \
mate-notification-daemon x2goserver x2goserver-xsession \
ubuntu-mate-themes firefox gnome-icon-theme
It will take awhile for the server to install all the packages. Once that is done, I will reboot the server with the reboot command list above.
By default, the server firewall is disabled. So go ahead and enable it and allow tcp port 22 to pass through and that is what X2Go server use.
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw reload
If you are planning to use Visual Studio code from Microsoft in your setup, you need to add a line to the x2goagent.options file.
sudo nano /etc/x2go/x2goagent.options
Scroll down to the bottom of the file and add the following line and then save it.
X2GO_NXAGENT_DEFAULT_OPTIONS+=" -extension BIG-REQUESTS"
Now, just restart the X2Go server
sudo systemctl restart x2goserver
Install X2Go client
Now go to https://wiki.x2go.org/doku.php and download the X2Go client. In this example, I am going to use the Windows client.
Launch the X2Go Windows client, create a new session and connect it to the server.
Done! You are now running a headless Ubuntu server with a Remote Linux Desktop.