Article - Run Linux Apps on Windows using Windows Subsystem for Linux
WSL or Windows Subsystem for Linux allows you to run GNU/Linux environment in Windows 10/11 directly without using a dual-boot configuration or a virtual machine.
GIMP running on Windows 11 installation, courtesy of WSLg
Prerequisites for WSL
WSL1/WSL2 requires Windows 10 Build 2004 or higher. For GUI Apps, aka WSLg, it requires Windows 11 Build 22000. You can install WSL on Windows 11 Home editions as well.
Installation
At the time of this writing, WSL supports multiple distributions of Linux, given below:
Name Friendly name
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
The installation of WSL is pretty simple:
In the Run Dialog box, type powershell.exe and press Ctrl+Shift+Enter, to run it as elevated.
Execute the command: wsl --install
This command would automatically enable required optional features and Install the default distribution Ubuntu for you.
If you want to change the default distribution, use the -d switch. For Example, to install Kali Linux, use wsl --install -d kali-linux
WSL installing Kali Linux
❗Bonus Tip❗: Additionally, You can install WSL from the Microsoft Store if the machine is on Windows 11. Link here. Make sure the Virtual Machine Platform named feature is enabled, in Windows features for installing from the Store, which can be enabled using this command:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
Difference between WSL1, WSL2, and WSLg
WSL2 is the next version of WSL, which can run ELF64 binaries on Windows, alongside supporting faster system performance. WSL1 and WSL2 can exist simultaneously, and you can configure a specific distribution to run on WSL1 or 2. From the documentation:
WSL 2 provides the benefits of WSL 1, including seamless integration between Windows and Linux, fast boot times, a small resource footprint, and requires no VM configuration or management. While WSL 2 does utilize a VM, it is managed and run behind the scenes, providing the same user experience as WSL 1.
WSLg is based on WSL2, which also allows you to run Linux-based GUI Apps on Windows 11.
Setting up WSL for first use
After the WSL distribution download is complete, you would need to configure it. Afterward, when the download is done, open the distribution from the start menu.
Now, the next step is to set up a username and password for opening the Distro. Enter your desired username and password, and press Enter. The username should be in small letters.
You would see username@PCName in the command line, waiting for a command.
Enter sudo apt update && sudo apt upgrade command to update the Distro with the latest packages.
Navigating with files
When the Distro is installed, Windows would add an option in the File Explorer so that you can directly access the files.
Run GUI Apps in WSL
If you are running Windows 11, you can run Linux GUI apps natively on Windows 11. See the steps below
Make sure the latest GPU drivers are installed from the GPU manufacturer.
If you had set up a Linux distribution before, you would need to update WSL to support GUI. For the same, execute wsl --update in an elevated Powershell. You can also check for Windows updates.
The next step is to download the specific app. Some of the widely used GUI apps on Linux can be installed using the commands below:
GEDIT:
- sudo apt install gedit -y
- GIMP: sudo apt install gimp -y
- VLC: sudo apt install vlc -y
Additionally, other apps, which the package manager does not support, can be installed by downloading a Debian package and the Command line. For Example, for Edge, see the steps below:
Download Microsoft Edge Insider Channels
For Microsoft Teams:
Swap directories into the temp folder: cd /tmp
Use the curl command to download the package: sudo curl -L -o "./teams.deb" "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=linux&arch=x64&download=true&linuxArchiveType=deb"
Use the apt command to install it: sudo apt install ./teams.deb -y
When the installation is complete, you will see the app listed in the Start menu. You can also cycle between apps using Alt+Tab.
GIMP installed using Ubuntu
Support
You can always search for or open an issue at GitHub as the WSL repository is maintained there.
Issues · Microsoft/WSL (github.com)
References:
FAQ's about Windows Subsystem for Linux | Microsoft Docs
microsoft/WSL: Issues found on WSL (github.com)
A preview of WSL in the Microsoft Store is now available! - Windows Command Line