How to Set Up WSL (Windows Subsystem for Linux): A Complete Guide

Windows Subsystem for Linux (WSL) allows developers and power users to run a genuine Linux environment directly on Windows without the overhead of a traditional virtual machine or dual-boot setup. It provides access to Linux command-line tools, utilities, and applications while keeping the familiar Windows desktop and applications available. This guide covers the supported Windows versions, detailed installation steps, key advantages, and important limitations of WSL so you can decide whether it fits your workflow and get it running correctly.


What Is WSL and Why It Matters

WSL is a compatibility layer (and, in its modern form, a lightweight virtualization layer) built into Windows. WSL 1 used a translation layer for system calls. WSL 2, the current default, runs a real Linux kernel inside a lightweight utility virtual machine managed by Hyper-V. This delivers near-native performance, full system-call compatibility, and support for modern features such as Docker, systemd (with configuration), GPU acceleration, and GUI Linux applications.

Microsoft designed WSL primarily for developers who need Linux tools - package managers, shells, build systems, and open-source software - without leaving Windows. It has since become popular among system administrators, students learning Linux, data scientists, and anyone who wants seamless access to both ecosystems.

How to Set Up WSL



Windows Versions That Support WSL

WSL support depends on the Windows edition and build:

  • Windows 11 (all current versions) fully supports WSL 2 and is the recommended platform.
  • Windows 10 version 2004 (Build 19041) or later supports the simple wsl --install command and WSL 2.
  • Older Windows 10 versions (1903 and 1909 with specific builds, and earlier) can still run WSL, but require manual installation steps and may be limited to WSL 1 or need additional kernel updates.
  • Windows Server 2019 (version 1709 and later), Windows Server 2022, and Windows Server 2025 also support WSL, with simplified installation available on 2022 and 2025.

To check your Windows version and build, press Windows key + R, type winver, and press Enter. Virtualization must be enabled in the BIOS/UEFI for WSL 2. Most modern PCs have this enabled by default; if not, enter the firmware settings and enable Intel VT-x, AMD-V, or equivalent.

WSL is available on both Home and Pro editions of Windows 10 and 11. Enterprise and Education editions work the same way, with additional management options available through Group Policy or MDM.


Step-by-Step Guide: How to Set Up WSL

The easiest and recommended method uses a single command on supported Windows versions.

Prerequisites

  • Windows 10 version 2004 (Build 19041) or later, or any Windows 11 release.
  • Administrator privileges.
  • An internet connection (to download the Linux kernel and distribution).
  • Virtualization enabled in BIOS/UEFI.


Method 1: Simple Installation (Recommended)

  1. Open PowerShell or Command Prompt as Administrator. Right-click the Start button and choose “Windows Terminal (Admin)” or “PowerShell (Admin)”.
  2. Run the following command:
    wsl --install
    This single command enables the required optional Windows features (Windows Subsystem for Linux and Virtual Machine Platform), downloads the latest Linux kernel, sets WSL 2 as the default, and installs the Ubuntu distribution by default.
  3. Restart your computer when prompted. The reboot completes the feature enablement and finishes the installation.
  4. After restart, launch Ubuntu (or your chosen distribution) from the Start menu. The first launch will prompt you to create a Linux username and password. Choose a username without spaces or special characters and a strong password. Note that the password will not echo characters as you type - this is normal Linux behavior.
  5. Once the account is created, you will be at a Linux bash prompt. You can immediately run commands such as sudo apt update && sudo apt upgrade to update the system.

To install a different distribution instead of Ubuntu, use:

wsl --install -d <DistributionName>

Available distributions can be listed with:

wsl --list --online

Common options include Debian, Kali Linux, openSUSE, Fedora, and others. After installation you can set the default distribution with wsl --set-default <DistroName>.


Method 2: Manual Installation (Older Windows Versions or Custom Needs)

If your Windows build is older or the simple command is unavailable:

  • Enable the Windows Subsystem for Linux feature. In an elevated PowerShell run:
    dism.exe /online /enable-feature/featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  • Enable the Virtual Machine Platform (required for WSL 2):
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart the computer.

  • Download and install the latest WSL Linux kernel update package from Microsoft’s official documentation page (search for “WSL2 Linux kernel update package”).
  • Set WSL 2 as the default version:
    wsl --set-default-version 2
  • Install a Linux distribution from the Microsoft Store or by downloading the package and installing it via PowerShell.

After installation, verify the setup with:

wsl --list --verbose

This shows installed distributions and which version (1 or 2) each is using. You can convert a distribution between versions with wsl --set-version <DistroName> <1|2>.


Post-Installation Essentials

Update the distribution regularly with the package manager (apt, dnf, zypper, etc.).

Install Windows Terminal for a modern multi-tab experience that integrates WSL nicely.

For development, install Visual Studio Code and the Remote – WSL extension. This lets you open folders and run the integrated terminal and debugger directly inside the Linux environment.

Enable systemd if needed (supported in recent WSL versions) by editing /etc/wsl.conf.

Configure GPU support for machine-learning workloads by installing the appropriate NVIDIA, AMD, or Intel drivers on the Windows side; WSL 2 can then access the GPU.

Access Windows files from Linux under /mnt/c, /mnt/d, etc., and Linux files from Windows Explorer by typing \\wsl$ in the address bar.


Troubleshooting common issues (installation failures, networking problems, or performance) is covered in Microsoft’s official WSL documentation. Most problems are resolved by ensuring virtualization is enabled, running Windows Update, or resetting the distribution with wsl --unregister <DistroName> followed by a fresh install.


Advantages of Using WSL

WSL offers several compelling benefits that make it attractive for many users:

Seamless integration between Windows and Linux. You can run Linux commands from Windows (and vice versa), share files effortlessly, and use Windows tools such as Visual Studio Code, browsers, or Office alongside Linux terminals and applications. This hybrid workflow is far more convenient than dual-booting or constantly switching virtual machines.

Lightweight and fast. Compared with a full virtual machine, WSL 2 starts almost instantly and consumes fewer resources while still delivering near-native CPU performance for most development tasks. File system performance inside the Linux environment is excellent.

Full Linux compatibility for development. Because WSL 2 uses a real Linux kernel, the vast majority of Linux command-line tools, compilers, interpreters, databases, and container technologies work as expected. Docker Desktop can use the WSL 2 backend, and many users run Kubernetes tools, Node.js, Python, Ruby, Go, and other stacks without friction.

No hardware compatibility headaches. Desktop Linux sometimes struggles with certain laptops’ Wi-Fi, graphics, or power management. With WSL you keep the Windows drivers and simply use Linux tools on top.

Easy entry point for learning Linux. Users who are new to Linux can experiment with bash, package management, and open-source software without committing to a full OS switch or risking their primary Windows installation.

Support for GUI applications and GPU acceleration. Modern WSL versions can run Linux graphical applications (via WSLg) and leverage the host GPU for CUDA, DirectML, and similar workloads—useful for data science and machine learning.

Lower resource and management overhead than dual-boot or full VMs. There is no need to partition disks or manage multiple boot loaders, and snapshots or resets of a distribution are simple.

These strengths make WSL especially popular among web developers, DevOps engineers, students, and professionals who need both Windows productivity software and Linux tooling.


Disadvantages and Limitations of WSL

Despite its strengths, WSL is not a perfect substitute for a native Linux installation or a full virtual machine in every scenario:

File system performance across the Windows-Linux boundary. Accessing files stored on the Windows side (/mnt/c) from Linux (or the reverse for intensive workloads) is slower than native performance because of the interop layer. Best practice is to keep project files inside the Linux file system when possible.

Hardware and peripheral access is limited. Direct access to certain USB devices, serial ports, or specialized hardware can be incomplete or require extra configuration. While GPU support has improved dramatically, some advanced hardware use cases still work better in a traditional VM or bare-metal Linux.

Resource usage and memory management. WSL 2 runs inside a lightweight VM. On systems with limited RAM the combined Windows + WSL memory footprint can become noticeable. The virtual machine can also retain memory until it is shut down with wsl --shutdown.

Not a complete desktop Linux replacement. Although GUI apps are supported, the overall desktop experience, window management, and deep system integration differ from a native Linux distribution. Some system-level services or low-level kernel modules may behave differently.

Potential conflicts with other virtualization software. Enabling the Virtual Machine Platform (Hyper-V related components) can conflict with older versions of VirtualBox or VMware on some systems. Newer versions of these products have improved compatibility, but users should check current documentation.

Learning curve and occasional quirks. Users unfamiliar with Linux still need to learn basic command-line concepts. Networking, systemd configuration, and certain edge-case applications can require additional setup compared with a pure Linux machine.

Dependency on the Windows host. Updates, security patches, and the overall stability of the Windows environment affect WSL. A problem with Windows virtualization features can impact the Linux environment.

For users who need maximum performance with intensive I/O across file systems, full hardware passthrough, or a completely isolated Linux desktop, a traditional dual-boot or dedicated Linux machine remains preferable. For the majority of development, scripting, and tooling needs, however, the limitations are manageable.


Best Practices and Next Steps After Setup

Once WSL is running, keep the distribution updated, install only the packages you need, and store active projects inside the Linux file system for best performance. Use Windows Terminal and the VS Code Remote - WSL extension for a polished daily workflow. Explore additional distributions if Ubuntu does not meet your preferences, and consider enabling systemd and GPU support according to your use case.

Microsoft continues to improve WSL with better networking, container features, performance enhancements, and tighter integration. Checking the official Microsoft Learn documentation periodically will keep you informed of new capabilities.


You may also like : How to Dual Boot Linux and Windows: A Complete Step-by-Step Guide


Conclusion

Setting up WSL on a supported Windows 10 or Windows 11 system is straightforward - often as simple as running one administrative command and restarting. The result is a powerful, low-overhead Linux environment that coexists peacefully with Windows applications and tools. The advantages of seamless interoperability, strong Linux compatibility, and convenience make it an excellent choice for developers and technical users. At the same time, understanding the remaining limitations around cross-file-system performance and hardware access helps set realistic expectations.

Whether you are learning Linux, developing cross-platform software, running containers, or simply want bash and apt available on your Windows machine, WSL provides a practical and efficient solution. Follow the steps outlined above, verify your Windows version, and you will be productive in a Linux environment within minutes.

By combining the strengths of both operating systems, WSL has become one of the most useful features Microsoft has added to Windows for technical users in recent years.

Comments

Popular posts from this blog

Can You Build Desktop and Web Apps with GDScript?

Godot Game Export into Mobile Android and iOS: Complete Step-by-Step Guide

How to Use Docker: A Complete Beginner’s Guide to Containers, Installation, and Real-World Benefits