WSL on Windows 11
WSL on Windows 11: A Developer’s Guide to Linux on Windows
Introduction
Windows Subsystem for Linux (WSL) has become a game-changer for developers, data scientists, and IT professionals who want to leverage Linux tools without leaving the Windows environment. Whether you're coding, managing servers, or experimenting with Linux-based workflows, WSL offers a seamless bridge between the two operating systems. In this guide, I’ll walk you through installing WSL on Windows 11 in the simplest way possible.
Why Use WSL?
- Run Linux command-line tools directly on Windows
- Use Linux-based development environments without dual-booting
- Access powerful package managers like
aptanddnf - Improve Docker and Kubernetes workflows on Windows
- Alternative to using VirtualBox or VMWare on Windows
Step-by-Step Installation Guide
Step 1: Enable WSL
Microsoft has made it incredibly easy to install WSL on Windows 11 with a single command.
Open PowerShell as Administrator (search for "PowerShell" in the Start menu, then right-click and select Run as administrator).
Run the following command:
wsl --install
This command will:
- Enable the required Windows features
- Download and install the latest WSL kernel
- Install Ubuntu as the default Linux distribution
Restart your computer when prompted.
Step 2: Verify the Installation
Once your computer restarts, open PowerShell or Command Prompt and type:
wsl --list --verbose
This will display a list of installed Linux distributions and their current state.
Step 3: Choose or Install a Different Linux Distribution
By default, Ubuntu is installed, but you can install other distributions like Debian, Kali Linux, or openSUSE. To see available distributions, run:
wsl --list --online
To install a different one, use:
wsl.exe --install <DistributionName>
For example, to install Ubuntu:
wsl.exe --install Ubuntu
Step 4: Set WSL Version (WSL 1 vs. WSL 2)
WSL 2 is the latest version and offers better performance and full system call compatibility. To ensure you're using WSL 2, run:
wsl --set-version <DistributionName> 2
For example:
wsl --set-version Ubuntu 2
To make WSL 2 the default for future installations:
wsl --set-default-version 2
Step 5: Running and Using WSL
Once installed, you can launch WSL in several ways:
- Open Windows Terminal and select the Linux distribution from the dropdown.
- Type
wslin PowerShell or Command Prompt. - Open your installed distribution directly from the Start menu.
Step 6: Update and Customize Your WSL Environment
After installation, update your Linux distribution:
sudo apt update && sudo apt upgrade -y
You can also install essential tools like Git, Node.js, Python, and Docker within your WSL instance.
Bonus: Integrating WSL with VS Code
For an even better development experience, install the Remote - WSL extension in Visual Studio Code to seamlessly work on Linux files within Windows.
- Open VS Code.
- Install the "Remote - WSL" extension.
- Open WSL by pressing
Ctrl+Shift+Pand selecting Remote-WSL: New Window.
Conclusion
With WSL on Windows 11, you get the best of both worlds: the versatility of Linux and the familiarity of Windows. Whether you're a seasoned developer or just getting started, WSL is a must-have tool for modern development workflows. Try it out, customize it to your liking, and level up your productivity!
Have thoughts or questions? Drop them in the comments!