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

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

Running Linux on Windows has never been easier. With Windows Subsystem for Linux (WSL), you can install and run a full Linux environment directly inside Windows — without needing a virtual machine or dual boot setup.
This is especially helpful for developers, IT support technicians, and anyone who needs Linux tools alongside Windows.


What is WSL?

WSL (Windows Subsystem for Linux) allows you to run Linux distributions like Ubuntu, Debian, or Kali directly on Windows.
It provides access to native Linux commands, package managers, and even graphical Linux applications right within your Windows environment.


Benefits of Using WSL

  • Run Linux commands directly in Windows Command Prompt or PowerShell.
  • Access both Windows and Linux file systems easily.
  • Install developer tools like Docker, Ansible, Git, Node.js, or Python without needing a separate VM.
  • Run GUI-based Linux apps (supported in WSL2).
  • Lightweight and fast compared to full virtual machines.

Step-by-Step: Installing WSL on Windows 11

Step 1: Open PowerShell as Administrator

Right-click on the Start Menu → select Windows Terminal (Admin) or PowerShell (Admin).
You’ll need admin rights to install WSL.


Step 2: Run the Installation Command

Type the following command and press Enter:

wsl --install

This command will:

  • Enable the Windows Subsystem for Linux feature
  • Install Virtual Machine Platform (required for WSL2)
  • Download and install Ubuntu by default
  • Set WSL2 as your default version
💡 Note: If you already have WSL installed, you can update it to WSL2 by running:wsl --set-default-version 2

Step 3: Restart Your Computer

Once the installation completes, you’ll be prompted to restart.
After restarting, WSL will continue setting up your Linux environment automatically.


Step 4: Set Up Your Linux Distro

After rebooting, you’ll see a terminal window asking for:

  • Username
  • Password

This creates your Linux user account inside the distro (e.g., Ubuntu).


Step 5: Update Linux Packages

Once your Linux terminal is ready, update all packages with the following commands:

sudo apt update && sudo apt upgrade -y

This ensures you have the latest Linux packages and tools.


Optional: Install a Different Linux Distribution

To view available Linux distros:

wsl --list --online

You’ll see options like:

  • Ubuntu
  • Debian
  • Kali Linux
  • openSUSE
  • Fedora Remix

To install another distribution, for example, Debian:

wsl --install -d Debian


Managing WSL Versions and Settings

You can check which version of WSL each distro is using:

wsl --list --verbose

To set WSL2 as the default version for all new distros:

wsl --set-default-version 2

To switch an existing distro to WSL2:

wsl --set-version <DistroName> 2

Example:

wsl --set-version Ubuntu 2


Accessing Windows Files from Linux

From within WSL, you can access your Windows files under /mnt/
For example:

cd /mnt/c/Users/

This takes you to your Windows “C:” drive.


Using Visual Studio Code with WSL

Install the “Remote – WSL” extension in VS Code.
You’ll then be able to open and edit files directly inside your Linux environment using the full power of VS Code — all from Windows.


Tips & Troubleshooting

  • To update WSL itself:wsl --update
  • To uninstall a Linux distribution:wsl --unregister <DistroName>
  • If you face any issues, run:wsl --status

Conclusion

Installing WSL on Windows 11 gives you the best of both worlds — the power of Linux combined with the flexibility of Windows.
Whether you’re coding, testing scripts, or managing servers, WSL makes it faster and simpler to get things done without needing to leave Windows.