How to Install Linux GUI Apps in Windows 10 and Windows 11 with WSL
As more apps are developed in Linux than ever before, Microsoft recognized that it needed to provide developers with an easy way to build, test, and run Linux apps without leaving the Windows desktop. The Windows Subsystem for Linux (WSL) was originally designed to provide an integrated Linux terminal environment in Windows without needing to set up and manage a virtual machine (VM).
But what if you want to run a Linux GUI editor, or other GUI app, using WSL?
Table of Contents
- How to install a Linux GUI app in Windows 10 and Windows 11
- Installing Linux GUI apps supported in Windows 10 21H2 and Windows 11
- What can I do with WSL GUI app support?
- How does WSL GUI app support work?
- How to update WSL to support GUI apps
- Installing Linux GUI apps in Ubuntu
- Starting Linux GUI apps and integration with the Windows UI
- Linux GUI apps in Windows 10 and Windows 11
Microsoft announced on April 21st that WSL in Windows 10 Insider Preview Build 21364 now supports Linux GUI apps. So, using build 21364 and higher, developers can run their preferred GUI editors and tools for testing and building Linux apps without having to jump through hoops like installing an X Server.
In this article, I’ll show you how to update WSL to support GUI apps, how to install a GUI app in Ubuntu, and finally look at how GUI Linux apps are integrated with the Windows user interface.
How to install a Linux GUI app in Windows 10 and Windows 11
Here are the steps you need to follow to install a Linux GUI app in Windows 10 or Windows 11:
- Install WSL or update an existing WSL installation
- Install your Linux GUI app in Ubuntu or other supported Linux distribution
- Start your Linux GUI app from the Windows Start menu
For more detailed instructions, keep on reading!
Installing Linux GUI apps supported in Windows 10 21H2 and Windows 11
Windows 10 21H2 isn’t coming until the second half of 2021 but Microsoft is busy releasing previews to Insiders. Until recently, WSL only officially supported Linux terminal applications. But Microsoft recently came good on a promise it made last year to bring GUI app support to the Windows Subsystem for Linux (WSL).
If you don’t know, WSL 2 is a feature in Windows 10 that lets developers add a Linux kernel to Windows and then load terminal support for several Linux distributions, including Ubuntu and SUSE.
For more information on Microsoft’s announcement, check out Microsoft Brings Linux GUI Apps to Windows 10 on Petri.
What can I do with WSL GUI app support?
The primary use case for Linux GUI app support is to run IDEs that are only supported on Linux. While many developers use Visual Studio Code on Windows to connect to their Linux instances in WSL, some developers prefer to use Linux tools like gedit, JetBrains, and gvim.
There are other applications too that only run in Linux. WSL now lets developers run those apps without setting up a Linux VM. The new GUI app support in WSL, sometimes referred to as WSLg, also lets developers test cross-platform GUI apps. There’s even support for audio and microphone.
For resource-intensive graphics applications, WSLg supports 3D acceleration via OpenGL. GPU hardware acceleration can benefit developers running complex apps that take advantage of WSL’s virtual GPU.
If you want to experiment with 3d accelerated graphics in WSL, Microsoft says for the time being, you’ll need to manually download a WDDMv3.0 driver for AMD, Intel, and NVIDIA GPUs respectively. These drivers will eventually be deployed automatically using Windows Update.
How does WSL GUI app support work?
When you run a Linux GUI app, Windows automatically starts a companion Linux distribution that includes XWayland, a pulse audio server, and everything needed for Linux GUI apps to run on Windows. Linux GUI apps are integrated with the Windows UI and when you terminate an app, the Linux companion distro session also ends to reduce system resource usage.
WSLg supports Wayland and X11 GUI applications. Microsoft developed WSLg as an open-source application, but it is designed to work without needing any changes. WSLg is isolated from the user’s Linux distribution so that WSLg can be serviced independently.
The WSLg companion distro uses CBL-Mariner, a lightweight and customizable Linux distribution maintained by Microsoft’s Linux System Group. CBL-Mariner was originally designed for headless, containerized workloads running in Azure or Microsoft’s edge services.
How to update WSL to support GUI apps
If you have WSL already installed in Windows and are upgrading to Insider Preview Build 21364, then you’ll need to update your existing WSL installation to support WSLg.
Update an existing WSL installation
There are two simple steps to update WSL. First, shutdown any running distros and then update WSL using the wsl.exe command-line tool.
- Open an elevated command prompt. In the search box in the bottom left of the taskbar, type cmd.
- In the search results, make sure that Command Line is highlighted and in the panel on the right, click Run as administrator.
- Give consent or type an administrator username and password as prompted.
- In the command line window, run the following type commands.
wsl --shutdown wsl --update
WSLg only supports WSL 2, so you’ll need to make sure any existing and future Linux distributions are configured to run in WSL 2. You can set existing distributions to use WSL 2 using the –set-version switch and by replacing distroname with the name of a Linux distribution installed on your PC. Use wsl –list -v to show the Linux distributions you have installed on your PC.
wsl --list -v wsl --set-version distroname 2
Then restart WSL to complete the process:
Install WSL for the first time with GUI app support
If you want to install WSL for the first time in Windows 10 Build 21364 or higher, then you just need to install WSL using the command line. WSLg support comes built-in. The command below installs WSL and then adds the Ubuntu distribution. You’ll be prompted to reboot your PC.
wsl --install -d Ubuntu
Installing Linux GUI apps in Ubuntu
Now launch your Linux distribution from the Windows Start menu. In this example, I’m using Ubuntu, so I’ll find the Ubuntu icon in the apps list on the Start menu. Clicking the Ubuntu icon launches an Ubuntu terminal window. Now install Linux GUI apps in the same way you would on any other Ubuntu distro.
For example, because Ubuntu is based on Debian, use the apt command to install apps. You’ll need to sudo the command to run it with elevated privileges in Linux. The first step is to update all my existing packages in Ubuntu:
sudo apt update
Here I use apt to install Nautilus, a GUI file manager for Linux:
sudo apt install nautilus -y
Another example is to install the preview version of Microsoft Edge for Linux. Here I need to download the package from Microsoft’s website and then run it using apt.
sudo curl https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-dev/microsoft-edge-dev_91.0.852.0-1_amd64.deb -o /tmp/edge.deb sudo apt install /tmp/edge.deb -y
Starting Linux GUI apps and integration with the Windows UI
Once your chosen apps have been installed, you’ll find them in the apps list on the Windows Start menu. Launch your Linux GUI apps like you’d run any Windows app.
Alternatively, you can launch GUI apps from your Linux terminal window. For example, to launch Nautilus from the terminal, I’d just type nautilus and press ENTER. Or microsoft-edge and press ENTER to run Microsoft Edge.
Edge is even identified as distinct from the version installed in Windows by the penguin in the bottom-right of the application icon.
Linux GUI apps in Windows 10 and Windows 11
WSLg is still a work in progress but it seems far along at this stage. Microsoft will be tweaking it in upcoming Insider builds before Windows 10 21H2 launches later in 2021. In my short time with it, WSLg seemed to work as expected. I didn’t install the virtual GPU graphics drivers as recommended by Microsoft. But even without them, everything seemed to work just fine.
If you can’t wait to get official support for Linux GUI apps in WSL, then you can switch to the Insider channel. Although these updates for WSL are currently only available to Insiders on the Dev Channel, which is considered the most unstable. So, you might want to wait until either the official 21H2 release or at least until WSLg makes it to the Beta or Release Preview Channels.
More in Windows 11
IT Admins Report Issues With Microsoft Store Version of Quick Assist App
May 16, 2022 | Rabia Noureen
Microsoft Releases May 2022 Patch Tuesday Updates
May 11, 2022 | Laurent Giret
What’s New with Windows – April 2022
May 2, 2022 | Russell Smith
How to Customize the Windows 11 Start Menu and Taskbar
Apr 28, 2022 | Michael Otey
Microsoft to Disable SMB1 File-Sharing Protocol By Default on Windows 11
Apr 20, 2022 | Rabia Noureen
This Week in IT - Microsoft Demos the Future of Windows 11 But ETA Missing in Action
Apr 8, 2022 | Russell Smith
Most popular on petri