Windows Subsystem for Linux 2 (WSL2) is the single best way to run Linux on a Windows 11 machine. It gives you a real Linux kernel, a full Ubuntu userland, and near-native file-system performance, all inside a lightweight virtual machine that boots in seconds and sips RAM when idle. If you write code, manage servers, or just want the Linux terminal without dual-booting, this is the setup to learn.
In this guide you will install WSL2 on Windows 11, set up Ubuntu 24.04 LTS, verify everything is actually running on the WSL2 engine, integrate it with VS Code and Windows Terminal, and learn the fixes for the five errors that trip up almost everyone on their first install.
Prerequisites
- A 64-bit PC running Windows 11 (build 22000 or newer; check with
winver). - An administrator account on the machine.
- Hardware virtualization (Intel VT-x or AMD-V) enabled in BIOS/UEFI. Most PCs ship with it on, but some don't — Step 1 shows you how to check.
- About 5 GB of free disk space and an internet connection (Ubuntu downloads on first install).
Step 1: Confirm Virtualization Is Enabled
WSL2 runs on a lightweight virtual machine, so CPU virtualization must be switched on in your firmware. Before touching anything, check it in Windows:
Open Task Manager (Ctrl + Shift + Esc), go to the Performance tab, and click CPU. At the bottom right you will see Virtualization: Enabled or Disabled. Alternatively, run this in PowerShell:
systeminfo
Scroll to the bottom: under Hyper-V Requirements, "Virtualization Enabled In Firmware" should say Yes.
If it says No, reboot into your BIOS/UEFI (usually Del, F2, or F10 at startup), find the setting called Intel VT-x, Intel Virtualization Technology, AMD-V, or SVM Mode, set it to Enabled, and save. This single setting is the cause of roughly half of all failed WSL installs.
Step 2: Install WSL2 and Ubuntu with One Command
On Windows 11, Microsoft simplified everything into a single installer command. Right-click the Start button and open Terminal (Admin) or Windows PowerShell (Admin) — elevation matters here — then run:
wsl --install
This downloads and installs the WSL2 engine, the Linux kernel update package, and the default Ubuntu distribution. On a fresh Windows 11 install this is genuinely all you need. If you want a specific distro version instead of the default, add the -d flag:
wsl --install -d Ubuntu-24.04
The command downloads a few hundred megabytes, so give it a minute or two. When it finishes, Windows will ask you to restart — do it now; the kernel components only load after a reboot.
Upgrading from an old WSL1 install? Runwsl --set-version Ubuntu 2to convert an existing distro, orwsl --set-default-version 2so every future install uses WSL2.
Step 3: Create Your Ubuntu User on First Launch
After the reboot, Ubuntu launches automatically (or find Ubuntu in the Start menu). The first launch takes a minute while it unpacks the filesystem. You will then be asked to create a UNIX username and password:
Enter new UNIX username: dev
New password:
Retype new password:
Pick a lowercase username with no spaces. This account is a full sudo user inside Ubuntu — it is separate from your Windows account, and its password is only used for sudo prompts inside Linux.
Step 4: Update Ubuntu's Packages
Fresh Ubuntu images are usually a few months behind on patches. Update everything before you do anything else:
sudo apt update && sudo apt upgrade -y
apt update refreshes the package lists from Ubuntu's servers, and apt upgrade -y installs all available updates without asking for confirmation on each one. This can take several minutes on the first run — that is normal.
Step 5: Update the WSL Kernel from Windows
WSL2's Linux kernel is serviced separately from the distro. Back in an elevated PowerShell (you can stay in the Ubuntu terminal for the rest, but this one runs on the Windows side), make sure the kernel is current:
wsl --update
This command pulls the latest WSL2 kernel from Microsoft. It fixes a whole class of cryptic errors (including the infamous 0x800701bc) and occasionally unlocks new features like systemd improvements. Run it any time WSL starts behaving strangely after a Windows update.
Step 6: Confirm You Are Really on WSL2
Everything should work now, but verify the engine version explicitly — a surprising number of "slow WSL" complaints turn out to be WSL1 distros:
wsl --list --verbose
You should see your distro listed with VERSION 2 and STATE Running or Stopped. Also check the kernel from inside Ubuntu:
uname -r
A healthy WSL2 system reports something ending in microsoft-standard-WSL2. If you see that string, you are on the real WSL2 kernel.
Step 7: Make It Feel Native — Terminal, VS Code, Files
Three integrations turn WSL2 from "a Linux box somewhere" into a daily driver:
1. Windows Terminal. Install it free from the Microsoft Store. It auto-detects your Ubuntu distro, gives you tabs, and renders the Linux terminal beautifully. Set Ubuntu as your default profile.
2. VS Code. Install the Remote - WSL extension in VS Code. Then, from your Ubuntu terminal, just run:
code .
VS Code opens with its backend running inside Linux — extensions, linters, and debuggers all execute in Ubuntu while the UI stays native on Windows. This is how most developers actually use WSL2 day to day.
3. Keep project files on the Linux side. WSL2 can see your Windows drives at /mnt/c, /mnt/d, and so on, but file access across the boundary is noticeably slower. Clone repos and keep code under your Linux home directory (~/projects). From Windows, browse the same files at \\wsl$\Ubuntu-24.04\home\dev in File Explorer.
Step 8 (Optional): Cap WSL2's Memory Usage
By default WSL2 can use up to 50% of your system RAM, which surprises people on 8 GB laptops. Create a .wslconfig file in your Windows user folder (C:\Users\<you>\.wslconfig) with:
[wsl2]
memory=4GB
processors=4
Then apply it by shutting WSL down completely from PowerShell:
wsl --shutdown
WSL restarts automatically the next time you open Ubuntu, now with the new limits. This also fixes the classic "WSL is eating all my RAM" complaint.
Verify It Worked
Run this quick checklist. If all four pass, your install is solid:
wsl --list --verbosein PowerShell shows VERSION 2.uname -rinside Ubuntu ends withmicrosoft-standard-WSL2.lsb_release -areports Ubuntu 24.04 LTS.- A Linux GUI app works: install one with
sudo apt install -y geditand rungedit— the window should pop up on your Windows desktop thanks to WSLg, no X server required.
Common Issues and Fixes
1. Error 0x80370102 — "WslRegisterDistribution failed"
Cause: hardware virtualization is disabled in BIOS/UEFI. Fix: reboot into firmware settings and enable Intel VT-x / AMD-V (see Step 1). On some machines you must also enable it in Windows Features under "Virtual Machine Platform".
2. Error 0x800701bc — "The WSL 2 kernel is not installed"
Cause: the kernel update package is missing or outdated. Fix: run wsl --update from an elevated PowerShell, then wsl --shutdown and relaunch Ubuntu.
3. Error 0xffffffff after a Windows update
Cause: the Virtual Machine Platform optional component got disabled. Fix: in elevated PowerShell run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Reboot, then wsl --update once more for good measure.
4. Locked out — forgot your Ubuntu password
Cause: the UNIX password is separate from Windows and easy to forget. Fix: in PowerShell, switch the distro's default user to root:
ubuntu2404.exe config --default-user root
Launch Ubuntu (you are now root), reset the password with passwd dev (replace dev with your username), close the terminal, then switch back with ubuntu2404.exe config --default-user dev.
5. Everything is slow when working in /mnt/c
Cause: cross-OS file access goes through the 9P protocol and is much slower than the native ext4 filesystem. Fix: move your project files into the Linux home directory (~/projects). Git operations and builds are typically 5-20x faster there.
Conclusion
You now have a complete Ubuntu 24.04 environment running on the WSL2 engine inside Windows 11: updated, verified, integrated with VS Code and Windows Terminal, with sane memory limits and the knowledge to fix the errors that stop most first-time installs. From here you can install Docker, Node.js, Python, or any server stack exactly as you would on a real Ubuntu VPS — the commands are identical.
Setting up dev environments, CI runners, or staging servers and would rather have an expert handle it? XpertBees helps teams configure Linux servers and developer workstations the right way the first time — get in touch and tell us what you are building.



