Running Linux on Windows 10 has never been more accessible, thanks to major architectural changes Microsoft introduced in recent years. That's why whether you are a developer needing a Bash environment, a student learning system administration, or a curious user wanting to explore open-source software, you no longer need to dual-boot or sacrifice your primary operating system. The most efficient method today is the Windows Subsystem for Linux (WSL), specifically WSL 2, which runs a genuine Linux kernel inside a lightweight utility virtual machine. This approach offers near-native performance, full system call compatibility, and seamless integration with the Windows file system and GUI applications Simple, but easy to overlook..
And yeah — that's actually more nuanced than it sounds.
Understanding Your Options: WSL vs. Virtual Machines vs. Dual Boot
Before diving into the installation process, it helps to understand the three primary paths available. Choosing the right one depends on your specific use case and hardware constraints.
1. Windows Subsystem for Linux (WSL 2) — Recommended for Most Users
This is the modern standard. It integrates directly into Windows, allowing you to run Linux command-line tools, utilities, and even graphical applications (via Wayland/X11 server built into Windows 11 and available on Windows 10 updates) side-by-side with Windows apps. It starts in seconds, uses minimal resources, and accesses your Windows files at /mnt/c/ Not complicated — just consistent..
2. Virtual Machines (Hyper-V, VirtualBox, VMware) Use this if you need a completely isolated environment, kernel-level debugging, or want to test different distributions (distros) simultaneously without affecting your host OS. It requires more RAM and CPU allocation and involves managing a full virtual hardware stack That alone is useful..
3. Dual Boot This installs Linux on a separate partition on your physical drive. It offers 100% hardware performance and direct kernel access but requires rebooting to switch operating systems. It carries a small risk of bootloader conflicts during major Windows updates.
For the vast majority of scenarios—web development, scripting, learning Linux commands, running servers—WSL 2 is the superior choice. The guide below focuses on this method.
Prerequisites for WSL 2 on Windows 10
To run WSL 2, your system must meet specific requirements:
- *Windows 10 Version 2004 (Build 19041) or higher. **Hardware Virtualization Support.Most modern CPUs support this, but it is often disabled by default on consumer laptops.
So ** This must be enabled in your BIOS/UEFI settings (usually labeled Intel VT-x, AMD-V, or SVM Mode). ** Check this by pressing
Win + R, typingwinver, and hitting Enter. But * **Administrator Privileges. ** You need admin rights to enable the optional Windows features.
Step-by-Step Installation: The Simplified Command (Windows 10 2004+)
Microsoft has condensed the previously complex multi-step process into a single command. This command enables the required optional components (Virtual Machine Platform and WSL), downloads the latest Linux kernel, sets WSL 2 as the default, and installs Ubuntu as the default distribution.
- Open PowerShell or Command Prompt as Administrator.
- Right-click the Start button > Select Windows PowerShell (Admin) or Terminal (Admin).
- Run the following command:
wsl --install - Restart your computer when prompted. This is mandatory for the Virtual Machine Platform feature to initialize correctly.
- After reboot, the installation will resume automatically. A console window will appear, decompressing the Ubuntu filesystem.
- You will be asked to create a UNIX username and password. This is separate from your Windows credentials. The password will not show characters as you type (standard Linux security behavior); just type it blindly and press Enter.
That’s it. Even so, you now have a fully functional Ubuntu environment. Launch it via the Start Menu ("Ubuntu") or by typing wsl or ubuntu in any terminal Easy to understand, harder to ignore..
Customizing Your Installation: Choosing a Different Distribution
While Ubuntu is the default, you might prefer Debian, Kali Linux, openSUSE, or Alpine. You can list available distributions and install a specific one during the initial setup or afterwards Practical, not theoretical..
To see available distros:
wsl --list --online
Output example:
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
To install a specific distro (e.g., Debian):
wsl --install -d Debian
To install multiple distros simultaneously: You can run the install command multiple times for different distros. They will coexist independently Small thing, real impact..
Manual Installation Steps (For Older Builds or Troubleshooting)
If the wsl --install command fails (common on builds older than 19041 or if Windows Update is broken), you can perform the steps manually.
1. Enable Required Windows Features
Run PowerShell as Admin and execute:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart your PC.
2. Download and Install the Linux Kernel Update Package
This package contains the actual Linux kernel compiled by Microsoft for WSL 2 And that's really what it comes down to..
- Download the WSL2 Linux Kernel Update Package for x64 machines from the official Microsoft documentation (search "WSL2 kernel update package").
- Run the
.msiinstaller. - Note: If you are on an ARM64 device (like a Surface Pro X), download the ARM64 package instead.
3. Set WSL 2 as Default Version
Back in Admin PowerShell:
wsl --set-default-version 2
4. Install Your Preferred Distro
You can install distros via the Microsoft Store (search "Ubuntu", "Debian", "Kali") or via command line:
wsl --install -d Ubuntu-22.04
Post-Installation Configuration: Making It Yours
Once your distro launches for the first time and you set your user credentials, run these essential commands to update the package lists and upgrade installed packages:
sudo apt update && sudo apt upgrade -y
Install Essential Build Tools
If you plan to compile code or use make, gcc, git, etc.:
sudo apt install build-essential git curl wget -y
Enable Systemd (Optional but Recommended)
Modern Linux distributions rely on systemd for service management (starting Docker, SSH, databases on boot). WSL 2 supports this, but it is off by default.
- Edit the WSL config file:
sudo nano /etc/wsl.conf - Add the following lines:
[boot] systemd=true - Save (
Ctrl+O,Enter) and Exit (Ctrl+X). - Shut down WSL completely from PowerShell (Admin):
Run the following command in an elevated PowerShell session to stop every WSL instance:
wsl --shutdown
Once the shutdown completes, simply launch your distro again from the Start menu or by typing wsl in any terminal. The kernel will restart with the new configuration you added to /etc/wsl.conf That's the whole idea..
Verify that systemd is active
Inside the freshly started distro, run:
ps -p 1 -o comm=
You should see systemd listed as the init process. For a more detailed view, you can also execute:
systemctl --status
If the output shows a healthy systemd service, the integration is working and any software that depends on systemd (Docker, PostgreSQL, etc.) will now start correctly on boot Not complicated — just consistent..
Installing systemd‑aware services
With systemd enabled, you can install and manage services just like on a native Linux machine. Take this: to set up Docker:
sudo apt install -y docker.io
sudo systemctl enable --now docker
Verify that Docker is running:
docker version
You should see both client and server sections, confirming that the daemon is managed by systemd.
Optional polish
-
Custom bash prompt – edit
~/.bashrcand add a prompt that shows the WSL version or current directory, e.g.:PS1='\[\e[01;32m\]WSL\$(wslversion) \u@\h \w\[\e[00m\]\$ ' -
Aliases – create useful shortcuts such as
alias ll='ls -alF'or `alias update='sudo apt update && sudo apt upgrade -y'
Daily Driver Tips & Troubleshooting
As you settle into using WSL 2 as your primary development environment, a few additional configurations can significantly smooth out the experience. To give you an idea, if you frequently switch between Windows and Linux paths, remembering that \\wsl$\ provides access to your distro’s filesystem from File Explorer (and vice versa with /mnt/c/, etc.) can save considerable navigation time.
Networking is another area where WSL 2 shines but occasionally requires attention. Because it runs its own internal virtual network interface, services like databases or web servers bound to localhost inside WSL won’t be reachable from Windows browsers by default. Worth adding: if you need external access, consider using 0. Think about it: 0. On top of that, 0. 0 binding within the container/service, or put to work Windows Subsystem for Linux’s built-in port forwarding via netsh or third-party tools like socat.
For those relying on GPU acceleration—whether for machine learning, rendering, or gaming—WSL 2 now supports this natively on compatible hardware. Enabling it typically involves updating your graphics drivers and ensuring you’re on the latest WSL 2 kernel version, after which nvidia-smi inside a distro will report the GPU without additional manual config.
Counterintuitive, but true.
If you encounter sluggish performance or unexpected disconnections, a common fix is resetting the WSL state entirely via wsl --shutdown followed by a fresh launch. Additionally, ensuring your Windows 10/11 build is up to date often resolves underlying kernel incompatibilities.
Conclusion
WSL 2 has matured from a niche tool for sysadmins into a solid, production-ready layer that bridges the gap between Windows and Linux with remarkable efficiency. By following the steps outlined—from initial installation and package management to enabling systemd, integrating services like Docker, and fine-tuning the user environment—you can transform a vanilla Windows machine into a versatile development platform that feels native to both ecosystems.
The key to a sustainable WSL workflow lies in balancing convenience with intentionality: leveraging the
leveraging the built‑in tooling and automation features turns a loosely‑configured shell into a reproducible, resilient development platform.
Automating Environment Reproducibility
-
Export and import your distro –
wsl --export <DistroName> backup.tarcreates a portable snapshot that can be restored on any machine withwsl --import <NewName> <InstallLocation> backup.tar. This is invaluable for disaster recovery or for provisioning fresh workstations Practical, not theoretical.. -
Dotfile management – keep your shell configuration, VS Code settings, and other dotfiles in a Git repository. A simple
stoworrcmsymlink setup lets you share the same configuration across multiple distros or even across different operating systems Small thing, real impact.. -
Package lock files – for language‑specific ecosystems (Node, Python, Rust, etc.) commit
package-lock.json,Pipfile.lock, orCargo.lock. Coupled with amakeorjustscript that runsapt install -y $(cat packages.txt)orpip install -r requirements.txt, you can rebuild the entire userland in a single command.
Integrated Development Experiences
-
VS Code Remote – WSL – install the “Remote – WSL” extension, then open your project folder directly inside the Linux file system. The editor runs on Windows, but all compilation, debugging, and file I/O happen in the WSL 2 kernel, giving you near‑native performance while still enjoying Windows UI features such as the integrated terminal, debugger, and IntelliSense.
-
Windows Terminal profiles – define a profile that launches your preferred distro with a custom working directory, environment variables, and even a startup command (e.g.,
cd ~/projects && vim .). This eliminates the need tocdmanually after each launch. -
SSH‑based workflows – if you need to work on remote servers, configure your SSH client to use the same key pair inside WSL. The
~/.sshdirectory is automatically shared between Windows and Linux, so you can manage keys with the Windows GUI while usingsshfrom the Linux prompt.
Security and Isolation
-
User namespace mapping – WSL 2 runs each distro in its own lightweight VM, providing strong isolation from the host. Still, avoid running untrusted binaries as root; prefer
sudoorsufor privileged actions. -
AppArmor profiles – the default AppArmor confinement for each distro can be fine‑tuned. Take this: you can disable network access for a specific service by editing
/etc/apparmor.d/usr.bin.<service>and reloading withsystemctl reload apparmor. -
Windows Defender integration – the Windows security suite scans files accessed through the
\\wsl$\share, so any malware that slips into your Linux file system will still be caught. Keep Windows Defender up to date for the best protection Took long enough..
Scaling Beyond a Single Distro
If you maintain multiple WSL distributions (e.g., Ubuntu for day‑to‑day work, Alpine for container builds, and a Debian‑based distro for legacy tooling), consider the following practices:
-
Separate home directories – each distro has its own
$HOME. Store shared data in a dedicated folder under/mnt/c/Users/<WindowsUser>/wsl-sharedand symlink it into each$HOMEwhere needed. -
Distro‑specific packages – use
apt-mark holdordnf versionlockto prevent accidental upgrades of critical packages that your projects depend on. -
Resource limits – WSL 2 allows you to cap CPU and memory per distro via the
.wslconfigfile (e.g.,<Linux> <MemoryLimit>=4GB <ProcessorCount>=2). Adjust these values to prevent a single distro from starving the host or other distros.
Conclusion
WSL 2 has evolved into a fully‑featured development layer that without friction blends the convenience of Windows with the power and flexibility of Linux. By mastering the core installation steps, enabling systemd, polishing the user environment, and integrating essential tools such as Docker, VS Code, and GPU acceleration, you create a reliable foundation for everyday coding.