Accessing remote Linux GUI apps from Windows 11
The use of an X server permits the execution of graphical user interface (GUI) apps on one machine whilst being displayed on another. Here’s a guide to setting this up from Windows 11.
If you perform work on a remote Unix computer (such as when using a High Performance Computing cluster), you’d be familiar with logging-in on the command line via SSH. But what if you need to access a graphical user interface? For instance, you might be developing pipelines for image analysis, or performing data analysis in R via RStudio. These tasks cannot be completed without a GUI, yet without having direct access to the hardware, how can this be achieved?
The answer is to use an X server (instructions below). Xserver is the display server for the X Window System, which provides the basic framework for building graphical user interfaces on Unix-like operating systems. It allows for network-transparent graphical displays, enabling applications to run on one machine while displaying on another.
The set-up for this can be tricky. One relatively easy solution is to run X2Go, a GUI app written for Windows. Whilst this will get the job done, it’s very clunky and doesn’t support some modern security features (such as logging-in with SSH keys managed by a password manager).
The better option is to set-up an X server. There are several options for this:
The most popular two are Xming and VcXsrv. I prefer to use VcXsrv because it’s open-source and free, unlike Xming and the other various offerings.
Steps for Setting-Up an X server on Windows 11
Step 1: Download and Install VcXsrv on Windows 11
Download VcXsrv from the official source and install it. You can also download and install it via Winget using the following command:
winget install --id marha.VcXsrv
Step 2: Set-Up VcXsrv
Assuming that you have not run an X server before, this should be straightforward. Launch VcXsrv from the Start menu in Windows by typing “Xlaunch”. This will initialise the programme.
Click on “multiple windows” and then choose “0” (zero) for the Display Number. Then press “Next”.

Choose “Start no client” (the default option) and click on “Next”.

Select “Disable access control” from the selection, then press “Next”.

If you would like to save your configuration for easy launching next time, choose “Save Configuration”. Save that file to a safe location. In future, if you want to launch VcXsrv without repeating these steps, you can double-click on this file.

When complete, press “Next”.
VcXsrv will now launch. You will be able to confirm this by looking for the Xorg logo in the toolbar.

Step 3: Log in to your server
I prefer to use Windows Terminal to access remote servers, but you can also use PuTTY.
On the command line, log into your server as follows:
ssh -Y username@server
Note the use of the -Y flag.
Step 4: Run a GUI-based application
From the command line, launch a GUI-based application that may be installed on your server. For instance, thunar or rstudio. A new window should open-up that displays the GUI app.

Problem-Solving
If this doesn’t work, there are a few things to try.
Check the Display variable
Enter the following command:
echo $DISPLAY
The result should be something like localhost:10.0 or 127.0.0.1:10.0. If it is something else, then the X11 forwarding isn’t actually being used.
If another IP address is listed, enter the following command:
nano ~/.bashrc
Then remove any lines that look like export DISPLAY=XXX.XXX.XXX.XXX:0.0.
Next, clear DISPLAY:
unset DISPLAY
Finally, reload the file:
source ~/.bashrc
You may need to restart VcXsrv and reconnect to your remote server to get this to work.
Kill Previous Sessions
If you have any previous VcXsrv sessions running for any reason, kill them in PowerShell:
taskkill /F /IM vcxsrv.exe
Comments
No comments have yet been submitted. Be the first!