A holographic 3D blueprint of a computer setup is projected above an office desk.
Setting Up WSL 2 on Windows 11​

  • Prerequisites**
  • OS Requirement: Windows 10 version 1903+ (Build 18362+) or Windows 11
  • Virtualization: Must be enabled in BIOS/UEFI
  • Permissions: Administrator access is required

1. Enable WSL and Virtual Machine Platform

Run these in elevated PowerShell:

Code:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart your computer after enabling these features.

2. Download and Install the Latest WSL 2 Kernel Package

3. Set WSL 2 as the Default Version

In an elevated PowerShell session, execute:

Code:
wsl --set-default-version 2

This ensures all new distributions use WSL 2’s lightweight VM backend.

4. Install a Linux Distribution

  • Open Microsoft Store
  • Search for Ubuntu, Debian, Fedora, etc.
  • Click Get and then Install
  • Launch the distro from the Start menu, and create a UNIX user account

5. Checking and Managing Installed Distros

View installed distros and their WSL version:

Code:
wsl --list --verbose

Convert a specific distro to WSL 2:

Code:
wsl --set-version <DistroName> 2

6. Running Linux GUI Apps

WSL 2 on Windows 11 supports GUI applications out of the box:

Code:
# Inside your distro’s shell
sudo apt update && sudo apt install gedit
gedit

Linux windows appear seamlessly alongside Windows apps, with audio and hardware acceleration.

7. Integrating Visual Studio Code

  • Install VS Code on Windows
  • In VS Code Marketplace, install the “Remote – WSL” extension
  • Open your project folder inside WSL with Remote‑WSL: New Window
  • Edit files, launch terminals, and debug inside the Linux environment

8. Optional: WSL Configuration Tweaks

Create a [.wslconfig] file in [%USERPROFILE%] to customize system resources:

Code:
[wsl2]
memory=4GB
processors=2

This controls how much memory and how many CPU cores WSL 2 can use.

9. Advanced Tips

  • GPU Compute: Enable CUDA by installing NVIDIA drivers for WSL
  • Docker Desktop: Use Docker’s WSL 2 backend for native container workflows
  • File Performance: Store code in the Linux filesystem (/home) rather than under /mnt/c for faster I/O

10. Troubleshooting

  • If wsl --status shows mismatched versions, run:
    Code:
    wsl --update
  • For network issues, reset:
    Code:
    netsh winsock reset
  • If GUI apps fail to launch, ensure the Windows Feature “Graphics Tools” is enabled

WSL 2 on Windows 11 bridges Windows and Linux in a single workflow. Whether you’re compiling code, running web servers, or experimenting with AI frameworks, this powerful subsystem makes Windows 11 a true all‑in‑one developer platform.

 

Last edited: