How to Install Windows Subsystem for Linux WSLg


Windows Subsystem for Linux (“WSLg”) with new features for Windows 11 and Windows 10 – that’s how it’s done

Microsoft previously shipped Windows Subsystem for Linux (WSLg) with Windows 10 by adding from windows features. But with Windows 11 it is also available as a preview via the Store. This version is now officially available. WSL 2 offers new interesting features such as the rendering support for graphical desktop apps. Further the integration of Init-system – systemd.

WSL 2 runs as a Hyper-V virtual machine. This is a change from the bridged network adapter used in WSL 1. This means that WSL 2 uses a NAT service for its virtual network.

WSL Fresh Install

WSLg 2 can be installed from the store. The Cumulative Update November 2022 must be installed in Windows 10 from 21H1, and in Windows 11 KB5020030 or KB5019157. This also in Windows Server 2022 KB5020030. WSL from the Store is also available for Windows Server 2022, although the Store app isn’t available here.

The latest WSL release can be downloaded from GitHub.

C:\> wsl.exe --install --web-download
Install WSL from the Store

Confirm the Windows Account Control with Yes, now WSL is installed from the store. The prompt to create a Linux user appears. This user can be arbitrary and does not have to match the Windows logon.

Reboot + First Launch

After reboot the installation will continue. You’ll be asked to enter a username and password. These will be your Linux credentials, they can be anything you want and don’t have to match your Windows credentials.

Windows Subsystem for Linux from Store

Windows Subsystem for Linux (WSL) can also be obtained from the store.

According to Microsoft, the store version will become the standard in the future. This is also reflected in the fact that only this version gets new features, which is also revealed by the fact that the update option is only available here.

C:\> wsl.exe --update

The recently released WSL 1.0 integrates support for WSLg, for graphical desktop applications under Linux into Windows. So that a separate installation of the MSI packages for WSL is no longer necessary. It is no longer limited to Windows 11, but also available for Windows 10.

The installed Windows Subsystem for Linux version with the different WSL components shows the following command.

C:\> wsl --version
wsl --version
WSLg-Version: 1.0.47
MSRDC-Version: 1.2.3575
Direct3D-Version: 1.606.4
Windows Version: 10.0.22621.819

Now you can install a Linux distribution, the much used Ubuntu can also be obtained from the store.

Alternatively, Windows Subsystem for Linux (WSL) can be installed completely along with Ubuntu, from a command prompt with Administrator privilege.

C:\> wsl --install -d Ubuntu

After rebooting, the installation continues. You will be asked to enter a username and password to log in Linux. This user can be arbitrary and does not have to match the Windows logon.

To upgrade an existing WSL installation without WSLg to the latest version of WSL that includes WSLg, then run the update from an elevated command prompt wsl --update

  Note that WSLg is only compatible with WSL 2 and does not work for the WSL distribution configured for WSL in mode 1. Make sure the Linux distribution is configured to run in WSL 2 mode, if does not, you can switch to WSL 2.

Windows Subsystem for (WSLg) Linux GUI Apps

WSLg is the abbreviation for Windows Subsystem for Linux (WSLg) GUI. The purpose of the project is to enable support for running Linux GUI applications (X11 and Wayland) on Windows in a fully seamless integrated desktop experience.

WSLg allows Linux GUI Apps natively on Windows

WSLg allows Linux GUI applications to fit natively and naturally on Windows. From integration into the Start menu to display in the taskbar, with Alt-Tab functionality, to applying copy and paste in Windows and Linux applications. WSLg enables seamless desktop integration with cross-workflow using Windows and Linux applications.

WSLg requires WSL in version 2 mode, which is what this tutorial does. The currently installed distribution and the configured WSL version can be listed with the following command, in an elevated command prompt.

C:\> wsl --list -v
  NAME          STATE           VERSION
* Ubuntu        Running         2
  kali-linux    Stopped         2

If you are running version 1 mode, switch to version 2 as follows, which may take a while.

C:\> wsl --set-version ubuntu 2

After that, the computer must be restarted.

Now you need some GUI apps, via the start menu you will find the Ubuntu icon, or you open the Windows Terminal (wt.exe) in which you will also find Ubuntu in the launcher.

WSLg Linux GUI Apps get from the Bash

Desired GUI apps can now be obtained from the Bash-Terminal.

$ sudo apt update
$ sudo apt install nautilus -y
$ sudo apt install gedit -y
$ sudo apt install x11-apps -y
$ sudo apt install vlc -y
$ sudo apt install nemo -y
$ sudo apt install mc -y
$ sudo apt install geary -y

WSLg Linux GUI App Google Chrome Browser

If your preferred browser is Google Chrome, it can be installed with the following lines.

cd /tmp
sudo wget
sudo dpkg -i google-chrome-stable_current_amd64.deb 
sudo apt install --fix-broken -y
sudo dpkg -i google-chrome-stable_current_amd64.deb

Although Firefox has overtaken Google Chrome in number of users, it is still very popular in the Linux world due to the Mozilla Foundation’s privacy-friendly features. The Linux version can also be easily installed with apt from the Ubuntu repository with apt install firefox

Install and run GUI Apps

Once these GUI apps are installed, you can find the apps in the Start menu under All apps with the name of the distribution.

The GUI apps can also be launched using the commands in the terminal window.

  • nautilus
  • xclock
  • gedit
  • geary
  • google-chrome
  • nemo
  • mc

Sources Link:

Windows Subsystem for Linux GUI Apps

Developer Feature VS Code in WSL

The VS Code WSL extension allows to save project files in the Linux file system using the Linux command line tools. it allows shared access to files from Linux (WSL) as well as from the windows host system. To create, debug or run a project in web browser in VS Code on Windows without using Performance degradation.

  You might also be interested in the related post here.

While WSL2 provides the complete command line experience to any developer, it is still not a complete replacement for actual Installation on a Virtual machine .

How useful was this post?

Click on a star to rate it!

Average rating 4.5 / 5. Vote count: 6

No votes so far! Be the first to rate this post.

One thought on “How to Install Windows Subsystem for Linux WSLg”

Leave a Reply

Your email address will not be published. Required fields are marked *