How to run Linux GUI applications with WSL2 on Windows

With the latest version of Windows Subsystem for Linux (WSL2), you can now run graphical Linux applications on Windows.


laptop with laptop

Windows 11 has a lot of new features, but one that is particularly welcome for users of the Windows Subsystem for Linux, or WSL. WSL users can now run graphical Linux applications as well as standard command line programs. Previously, this was a feature limited to Windows Insider members, but now regular Windows users can take advantage of it as well.


If you’ve just upgraded to Windows 11 and can’t wait to give it a try, read on.


Install graphics drivers


Links to update Windows graphics drivers

In order to run GPU-accelerated Linux GUI applications, you will need to install the latest video drivers for your hardware. Microsoft has helpfully created links to drivers for the three major GPU manufacturers: Intel, AMD, and NVIDIA.

To download: Graphics drivers for WSL2

Follow the appropriate link to download the installer for your graphics driver. If you are unsure what type of video hardware you have, open Device Manager from Control Panel and click “Display Cards.” This should show what type of video card you have.

Once you have downloaded the executable, run it to install the latest drivers for your system. You may need to restart your computer when it is finished.

VIDEO OF THE DAY MAKEUSE

Update from WSL version to WSL2

Assuming you already have a working WSL installation, all you need to do is make sure that you are using the latest version. To do this, just run this command in a PowerShell window as administrator:

wsl --update

To force a restart, use this command:

wsl --shutdown

Open WSL again and you will now be ready to run graphical Linux applications on Windows.

Running graphics applications


wslg-gvim

To run graphics applications, you can invoke them from the command line just like you would on any other Linux system. For example, to run the graphical version of Vim, you would type this into the shell:

gvim

This will launch Vim in a window. You can also launch Linux GUI applications from the Start menu. They will appear in a folder with the name of the distribution you are using. For example, with Ubuntu, they will be in the “Ubuntu” folder.


Running GUI applications over the network


wslg-ssh

The advantage of X11 programs is that they are transparent over the network, which means they can run on one machine while viewing their output on another machine over a network.

To do this with WSL, connect in SSH to a remote server on which X11 forwarding is enabled. On the client side, you will need to use the -X Where -O options to activate the X transfer to your machine.

You can now run Linux GUI applications on Windows

The ability to run Linux GUI applications in Windows is a welcome addition and makes the Windows Subsystem for Linux much more usable, as you are no longer limited to just text-based applications.

If you don’t just want to run a single app, but an entire Linux desktop on Windows, you can do that as well.


run-linux-windows subsystem
How to run a Linux desktop using the Windows Subsystem for Linux

The Windows Subsystem for Linux ships without a desktop computer. Here’s how to install a WSL desktop environment like GNOME or LXDE on Windows.

Read more


About the Author


Source link

Steven L. Nielsen