How to Install Xsrv on Ubuntu Server Latest

Xsrv is an X Server which allows you to run graphical Linux applications on a Windows computer or a remote Linux server. In this tutorial, we will guide you through the step-by-step process of installing Xsrv on Ubuntu Server.

Prerequisites

Before you start the installation process, make sure that you have the following:

Step 1: Update the Ubuntu System

To ensure that your Ubuntu Server has the latest software packages and security updates, update the system by executing the following command:

sudo apt-get update && sudo apt-get upgrade -y

Step 2: Install Xsrv

Xsrv is a package available in the default Ubuntu repositories. To install it, run the following command:

sudo apt-get install xserver-xorg xinit

Step 3: Configure Xsrv

After installation, Xsrv needs to be configured to allow remote connections. To do this, create a new configuration file as follows:

sudo nano /etc/X11/xorg.conf

Add the following lines to the file:

Section "ServerFlags"
    Option "listen" "TCP"
EndSection

Section "InputDevice"
    Identifier "Mouse0"
    Driver "mouse"
    Option "Protocol" "auto"
    Option "Device" "/dev/input/mice"
    Option "ZAxisMapping" "4 5 6 7"
EndSection

Save and close the file by pressing CTRL+O followed by CTRL+X.

Step 4: Test Xsrv Configuration

Next, test the Xsrv configuration by starting the X Server using the startx command:

startx

If the X Server starts successfully, you should see a new X Window System desktop environment.

Step 5: Connect to Xsrv from a Remote System

Finally, to connect to Xsrv from a remote system, you need to allow inbound connections on TCP port 6000. To allow the inbound traffic, execute the following command:

sudo ufw allow 6000/tcp

Then, on your client computer, install an X11 client software such as Xming (for Windows) or XQuartz (for macOS), and configure it to use the IP address of your Ubuntu Server and port 6000.

Once you have configured the client software, launch a graphical application on the remote system, and it should appear on your desktop.

Conclusion

In this tutorial, we have shown you how to install and configure Xsrv on Ubuntu Server Latest. With Xsrv, you can run graphical Linux applications remotely, making it easy to control your Linux environment from a Windows or macOS computer.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!