WSL stands for Windows Subsystem for Linux. It is a compatibility layer developed by Microsoft that allows running a full-featured Linux environment directly on Windows operating systems. WSL enables users to execute Linux binaries and run Linux command-line tools and applications natively on Windows without the need for a separate virtual machine or dual-boot setup.
There are currently two versions of WSL available:
WSL 1: The initial version of WSL provides a compatibility layer to run native Linux binaries on Windows. It translates Linux system calls into Windows equivalents, allowing Linux command-line tools to run seamlessly. However, it does not provide a Linux kernel and has some limitations in terms of performance and compatibility with certain Linux applications.
WSL 2: The newer version of WSL, WSL 2, introduced significant improvements. It includes a lightweight virtual machine that runs a full Linux kernel. This architecture provides improved compatibility, performance, and support for running various Linux distributions. WSL 2 also enables features like full system call compatibility, improved file system performance, and the ability to run Docker containers natively.
With WSL, users can choose from a variety of Linux distributions available from the Microsoft Store, such as Ubuntu, Debian, Fedora, and more. Once installed, WSL integrates with the Windows command prompt, PowerShell, or other compatible terminals, allowing users to seamlessly switch between Windows and Linux environments.
WSL has gained popularity among developers, system administrators, and enthusiasts, as it provides a convenient way to leverage Linux tools and workflows directly within the Windows ecosystem. It enables developers to have a consistent development environment across different platforms and facilitates tasks such as web development, scripting, system administration, and cloud operations.
By default, the WSL feature is disabled. So the first step, we will enable the feature. Open Windows PowerShell and run it as Administrator
Then, issue the following command the enable the WSL feature.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
To enable the Windows Virtual Machine Platform, please issue the following command.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Important: After the above operations, you need to restart your PC so the enabled features can apply.
After you computer restarts, click the link to download the Linux kernel update package.
Next, open the file to install the package. Click Next to install Windows Subsystem for Linux Update on your computer.
Once it completes, click Finish.
Open the PowerShell again the run the following command to set WSL2 as default.
wsl --set-default-version 2
There are many Linux-distributions that are supported by WSL 2, such as Ubuntu, OpenSUSE, Kali, Debian, Fedora, and Pengwin. You can find different versions of the Linux distributions in Microsoft store. You can also click the link to open the Microsoft store page for a specific distribution: https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-6—install-your-linux-distribution-of-choice. Open the Microsoft store and search for a Linux distribution you'd like to use and click get to install it.
Once the distribution is downloaded, open it.
You will be prompted to create a user for your Ubuntu instance, and a password for the user.
After that, you can start using your Ubuntu.