How to install WSL on Windows

In recent years, development on Windows has taken a huge leap forward thanks to tools that allow seamless integration of Linux environments directly into the operating system. In this article, we will discuss How to install WSL on Windows. Please, see What is Windows Subsystem for Linux, Various methods to install Windows Subsystem for Linux, and Install Ubuntu 20.04 LTS on Windows via WSL.
One of the most powerful solutions is the Windows Subsystem for Linux (WSL), which enables developers to run Linux distributions without relying on virtual machines or dual-boot setups. In this guide, we’ll walk you step by step through installing WSL on Windows, configuring your environment, and unlocking its full potential making your workflow more efficient and versatile.
Whether you’re a curious beginner or an experienced professional, this guide provides everything you need to start developing on Linux right from your Windows PC.
Also, see “how to install Windows Subsystem for Linux on Windows Server“, and “WSL Error 0x8007019e: WSL Register Distribution failed with error“.
Enable Windows Feature
Use the command below to enable Windows Features
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Download package Ubuntu.appx
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing

Rename & extract Ubuntu.appx
Rename-Item .\Ubuntu.appx .\Ubuntu.zip
Expand-Archive .\Ubuntu.zip .\Ubuntu


Check Ubuntu dir

list file dir command

cd C:\Users\Administrator\Ubuntu
dir
Rename-Item .\Ubuntu_2004.2021.825.0_x64.appx .\Ubuntu_2004.2021.825.0_x64.appx.zip

Expand-Archive .\Ubuntu_2004.2021.825.0_x64.appx.zip
dir

Move the extracted files to C:\Users\Administrator\Ubuntu

Change dir and list files and lunch installation
.\ubuntu.exe


Post installation: Add your Linux distribution path to the Windows environment PATH (C:\Users\Administrator\Ubuntu in this example), using PowerShell:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")
Here is the new WSL icon to launch the shell.

List your os-release distro
cat /etc/os-release

I hope you found this guide very useful on “how to install WSL on Windows”. Please, feel free to leave a comment below.