Windows Subsystem for Linux (WSL) provides an easy way to run a GNU/Linux environment on Windows, without using a third-party hypervisor like VirtualBox or VMware. WSL 1 came with a bevy of features, allowing users to run Linux commands, utilities, and other tools within a command-line interface.

The latest version of WSL (WSL 2) can even run graphical Linux apps on Windows and employs a fully-functional Linux kernel with added functionalities for faster system calls and better file I/O performance.

This guide will demonstrate how you can install WSL 2 on a computer running Windows 10.

Step 1: Install WSL on Windows 10

If you already have WSL installed, skip to the next step. For those who don't, enable the WSL feature and set up a distro on your system first. To do that, head over to the Start menu and search for "Turn Windows Features On or Off." Then, select the most relevant result from the list.

A new window will open. Scroll down and check off the boxes next to "Windows Subsystem for Linux" and "Virtual Machine Platform." Click Ok to continue.

enable wsl service on windows

Windows will now search for and download the necessary files. Once the download completes, click on Restart Now to reboot your machine.

Step 2: Download the WSL 2 Kernel Update

To install WSL 2, first, you need to download and install the latest WSL 2 kernel update.

Download: WSL 2 Kernel Update

Follow the on-screen instructions to install the downloaded program on your system.

Once done, launch Command Prompt (run as administrator preferred) and enter the following command to set the default version of WSL to 2:

        wsl --set-default-version 2
    

Step 3: Install a Linux Distro for WSL

Next, download a Linux distro for WSL, from either Microsoft Store or Command Prompt. Downloading a distro from Microsoft Store is easy. Simply launch it, search for the distro name, and click Get to install it on your system.

To install a distro via the command line, run:

        wsl --install -d distroname
    

...where distroname is the name of the Linux environment you want to install. You can check the available options using the command:

        wsl --list --online
    

For the purpose of this guide, let's install Ubuntu:

        wsl --install -d Ubuntu
    

WSL will now download files associated with the distro and set up an environment for you. You might have to wait for a few minutes for this process to finish.

Related: How to Run Graphical Linux Apps With WSL 2 on Windows

Step 4: Switch the WSL Version for Existing Distros

As we've already set the default version of WSL to 2 in the second step, any new distro you install should automatically run on WSL 2. But if not, you can manually switch the version as well.

To do that, first, you need to check the version of WSL your distros are currently running on. You can do so by typing:

        wsl -l -v
    
wsl version 1 ubuntu

The output will display a list of installed distros with the corresponding WSL versions. To change the version to WSL 2, type the following command:

        wsl --set-version distroname 2
    

For example, to switch Ubuntu to the latest WSL version:

        wsl --set-version Ubuntu 2
    

The conversion process will commence and you'll have to wait for some time depending on your system specs. Once done, check the WSL version again to verify the change:

        wsl -l -v
    
wsl version 2 ubuntu

That's it. You've now successfully installed WSL 2 on your Windows 10 machine.

Running Linux Distros on Windows

While Windows Subsystem for Linux isn't the most convenient way to run a Linux environment on Windows, it is still by far the most appropriate choice if your work revolves around the Linux command line.

If you want a distro with a full-fledged desktop running within Windows, consider installing a hypervisor like VirtualBox or VMware. Unlike WSL, you'll have a lot more choices for distros to install and desktops to customize.