PCSUPPORTHUB

How to Install a Linux GUI in WSL2 on Windows

A practical Windows 10 and Windows 11 guide to running Linux graphical apps with WSLg and installing a full Linux desktop environment inside WSL2.

Windows 10 Windows 11 WSL2 Linux GUI

Linux GUI on WSL2: What You Can Install

Windows Subsystem for Linux 2 can run Linux command-line tools and, on supported systems, graphical Linux applications. There are two common ways to use a Linux GUI in WSL2:

  • Run individual Linux GUI apps with WSLg, such as Gedit, Nautilus, Firefox, GIMP, or other desktop applications.
  • Install a full Linux desktop environment, such as XFCE, and connect to it with Remote Desktop.
â„šī¸
Recommended option: for most users, WSLg is easier and cleaner because it integrates Linux GUI apps directly into Windows. A full desktop environment is useful only when you specifically need a Linux desktop session.

Requirements for Installing a Linux Graphical Interface in WSL2

Before you start, make sure your system meets these requirements:

  • Windows 11 or Windows 10 version 21H2 / build 19044 or newer for built-in Linux GUI app support.
  • WSL2 installed and updated.
  • A Linux distribution installed, for example Ubuntu.
  • Virtualization enabled in BIOS or UEFI.
  • Updated GPU drivers if you want hardware-accelerated Linux GUI apps.

To check your Windows version, press Win + R, type the following command, and press Enter:

winver

Step 1: Install WSL2 and Ubuntu on Windows

Open PowerShell or Windows Terminal as administrator and run:

wsl --install

This command installs WSL, enables required Windows components, installs the default Linux distribution, and sets up WSL2 on supported systems. Restart the computer if Windows asks you to do so.

After restart, Ubuntu may open automatically and ask you to create a Linux username and password. These credentials are separate from your Windows account.

To confirm that your distribution uses WSL2, run:

wsl -l -v

If your distribution shows version 1, convert it to WSL2:

wsl --set-version Ubuntu 2

Step 2: Update WSL to Enable Linux GUI App Support

If WSL is already installed, update it before installing GUI applications:

wsl --update
wsl --shutdown

Then open your Linux distribution again from the Start menu or by running:

wsl
✅
Tip: On modern Windows builds, you usually do not need to install a separate X server such as VcXsrv just to run Linux GUI applications. WSLg provides the required integration automatically.

Step 3: Install and Run Linux GUI Apps in WSL2 with WSLg

First, update the package list inside Ubuntu:

sudo apt update
sudo apt upgrade -y

Now install a simple graphical application for testing:

sudo apt install gedit -y

Launch it from the WSL terminal:

gedit

If everything is configured correctly, the Linux GUI application will open as a normal window on the Windows desktop. You can also install other applications:

sudo apt install nautilus -y
nautilus

Examples of useful Linux GUI applications you can run in WSL2:

  • Gedit — lightweight text editor.
  • Nautilus — GNOME file manager.
  • GIMP — image editor.
  • Firefox — Linux browser for testing.
  • Kate — advanced text editor.

How to Install a Full Linux Desktop Environment in WSL2

WSLg is designed for individual Linux GUI apps, not necessarily for a complete Linux desktop session. If you want a full graphical Linux environment, one practical approach is to install XFCE and connect to it through Windows Remote Desktop.

âš ī¸
Important: a full desktop in WSL2 uses more disk space, more memory, and more background services than simple WSLg apps. Create a backup or export your WSL distribution first if the environment is important.

Install XFCE and XRDP

Inside Ubuntu in WSL2, run:

sudo apt update
sudo apt install xfce4 xfce4-goodies xrdp -y

Configure XRDP to Start XFCE

Create or update the XRDP startup file:

echo "startxfce4" > ~/.xsession

Restart the XRDP service:

sudo service xrdp restart

Find the WSL2 IP Address

Run this command inside Ubuntu:

hostname -I

Copy the first IP address shown. It usually looks similar to 172.x.x.x.

Connect from Windows Remote Desktop

  1. Press Win + R, type mstsc, and press Enter.
  2. Enter the WSL2 IP address and click Connect.
  3. Log in with your Linux username and password.
  4. Select the default Xorg session if prompted.

You should now see the XFCE desktop running from your WSL2 Ubuntu environment.

How to Start the Linux Desktop Again Later

After restarting Windows or shutting down WSL, start Ubuntu and run:

sudo service xrdp restart
hostname -I

Then connect again with Remote Desktop Connection. If the WSL2 IP address changed, use the new IP address.

WSLg vs Full Linux Desktop in WSL2: Which Method Should You Use?

Method Best For Advantages Disadvantages
WSLg Running individual Linux GUI apps Simple setup, good Windows integration, no separate desktop session Not intended to replace a complete Linux desktop
XFCE + XRDP Using a full Linux desktop environment Traditional desktop interface, useful for testing Linux UI workflows Consumes more resources and requires Remote Desktop setup
Third-party X server Older Windows setups or custom X11 workflows Flexible for advanced users More configuration, firewall issues, less convenient than WSLg

Fix Linux GUI Apps Not Opening in WSL2

If graphical Linux applications do not start, use the checks below.

Check That WSL Is Updated

wsl --update
wsl --shutdown

Check That the Distribution Uses WSL2

wsl -l -v

If needed, convert the distribution:

wsl --set-version Ubuntu 2

Install Updates Inside Linux

sudo apt update
sudo apt upgrade -y

Restart the Linux Application

Close the app, shut down WSL, and start again:

wsl --shutdown
wsl

Install or Update GPU Drivers

If GUI apps open but performance is poor, install the latest graphics driver from Intel, AMD, or NVIDIA. This is especially important for applications that use OpenGL acceleration.

Fix XRDP Connection Problems

If Remote Desktop cannot connect to the Linux desktop, restart XRDP and check the WSL2 IP address:

sudo service xrdp restart
hostname -I

Also make sure that the Remote Desktop client uses the current WSL2 IP address, because it can change after restarting WSL or Windows.

How to Remove the Linux Desktop Environment from WSL2

If you no longer need the full desktop environment, remove XFCE and XRDP:

sudo apt remove --purge xfce4 xfce4-goodies xrdp -y
sudo apt autoremove -y

To remove only individual GUI applications, uninstall them by package name. For example:

sudo apt remove gedit nautilus -y
sudo apt autoremove -y

FAQ: Linux Graphical Interface in WSL2

Do I need VcXsrv or Xming for WSL2 GUI apps?

Usually no. On supported Windows versions, WSLg handles Linux GUI app integration automatically. A third-party X server is mostly needed for older systems or special X11 configurations.

Can I run GNOME or KDE Plasma in WSL2?

It is possible to experiment with larger desktop environments, but XFCE is usually easier and lighter in WSL2. GNOME and KDE may require more services and additional configuration.

Can I access Windows files from Linux GUI apps?

Yes. Windows drives are usually mounted under /mnt. For example, the C: drive is available at:

/mnt/c

Is WSL2 a replacement for a full Linux virtual machine?

Not always. WSL2 is excellent for development tools, Linux command-line utilities, and many GUI apps. A full virtual machine is still better when you need a complete Linux boot process, kernel modules, systemd-heavy desktop behavior, or isolated testing.

Summary

The easiest way to use a Linux graphical interface in WSL2 is to update WSL and run Linux GUI apps directly through WSLg. For most users, this is enough: install an app with apt, launch it from the terminal, and it appears on the Windows desktop.

If you need a complete Linux desktop, install XFCE and XRDP, then connect from Windows using Remote Desktop. This method requires more configuration, but it gives you a traditional Linux desktop session inside WSL2.