How to Install Windows Subsystem for Linux (WSL) on Windows 10

Are you a Windows 10 user looking to explore the world of Linux without the need for dual-boot setups or virtual machines? Windows Subsystem for Linux (WSL) provides the perfect solution. In this step-by-step guide, we will walk you through the process of installing WSL on Windows 10, opening up a whole new realm of possibilities for developers, system administrators, and Linux enthusiasts.

What is WSL?

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.

Steps to Install WSL2 on Windows 10

Prerequisites
In this guide, we will install the latest version of WSL, namely WSL2. To proceed, make sure you are running Windows 10
(For x64 systems: Version 1903 or later, with Build 18362.1049 or later. For ARM64 systems: Version 2004 or later, with Build 19041 or later.)

1. Enable WSL on your Device

By default, the WSL feature is disabled. So the first step, we will enable the feature. Open Windows PowerShell and run it as Administrator

Open PowerShell

Then, issue the following command the enable the WSL feature.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart 
Enable WSL in PowerShell

2. Enable the Virtual Machine Platform optional feature

To enable the Windows Virtual Machine Platform, please issue the following command.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Enable Virtual Machine Platform in PowerShell

Important: After the above operations, you need to restart your PC so the enabled features can apply.

3. Download and install the Linux kernel update package

After you computer restarts, click the link to download the Linux kernel update package.

Linux kernel update package is downloaded

Next, open the file to install the package. Click Next to install Windows Subsystem for Linux Update on your computer.

Click Next to install Windows Subsystem for Linux Update on the computer

Once it completes, click Finish.

Installing Windows Subsystem for Linux Update finishes

4. Set WSL2 as default

Open the PowerShell again the run the following command to set WSL2 as default.

wsl --set-default-version 2
Set WSL2 as default

5. Installing a Linux Distribution

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.

Open Microsoft Store
Click Get to install a Linux distribution

Once the distribution is downloaded, open it.

Open your Linux distribution

You will be prompted to create a user for your Ubuntu instance, and a password for the user.

Create a user

After that, you can start using your Ubuntu.

Start using Ubuntu