The Windows Subsystem for Linux (WSL) provides a native Linux environment within Windows, leveraging real Linux features while maintaining compatibility with existing Windows tools. It allows seamless access to Linux command-line utilities and development workflows without requiring separate virtual machines or dual-boot configurations. This approach integrates Windows and Linux functionality for software development and system administration tasks.

Two primary versions of WSL are available: WSL 1 relies on a translation layer for system calls, while WSL 2 uses an actual Linux kernel. WSL 1 offers faster file access on Windows storage, whereas WSL 2 provides a more complete Linux experience with broader container support. The choice between WSL 1 and WSL 2 may depend on performance needs and workload specifics.

Because WSL 2 enables full system call compatibility, it is often preferred for running complex Linux applications and containerized workloads. It also integrates with tools like Docker Desktop, offering smoother container management on a Windows host. Both versions aim to simplify development and create a unified environment for cross-platform tasks.

Steps to enable Windows Subsystem for Linux (WSL) on Windows:

  1. Check that you are running Windows 10 version 2004 or later, or Windows 11.

    Use the winver command in the Run dialog to confirm your exact Windows build.

  2. Ensure that hardware virtualization is enabled in the firmware or BIOS if required by WSL 2.

    Look for Intel VT-x or AMD-v virtualization settings in BIOS or UEFI, and enable them if disabled.

  3. Launch PowerShell or Windows Terminal as an administrator from the Start menu.
  4. Install WSL by running the following command.
    wsl --install
    Installing: Windows Subsystem for Linux
    Virtual Machine Platform: Enabled
    Setting WSL version 2 as default
    Restart required

    This command enables both WSL 1 and WSL 2, along with the required Virtual Machine Platform.

  5. Restart the computer once the installation is completed.
  6. Set WSL 2 as your default version.
    wsl --set-default-version 2
    Default version of WSL set to 2

    Future Linux distributions will automatically use WSL 2 after this setting.

  7. Install a Linux distribution from the Microsoft Store.

    Search for Ubuntu, Debian, or other supported distributions and click “Install.”

  8. Verify your installation and distribution versions.
    wsl -l -v
    NAME      STATE           VERSION
    * Ubuntu    Running         2

    Switch an existing distribution to WSL 2 with

    wsl --set-version <distribution-name> 2

    if required.

Discuss the article:

Comment anonymously. Login not required.