Install WSL2 and Ubuntu on Windows
One command installs the Windows Subsystem for Linux and Ubuntu. Then learn how to pick a distribution, check which WSL version you run, update it and reach your files from both sides.
Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?
The Windows Subsystem for Linux (WSL) runs a real Linux distribution inside Windows, with a full kernel, package manager and shell. WSL2, the current version, uses a lightweight virtual machine, so Docker, systemd and most Linux software behave the way they do on a Linux server. You keep Windows for everything else.
Requirements
- Windows 11, or Windows 10 version 2004 and higher (build 19041 and higher). Check with
winver. - Hardware virtualization enabled in the firmware (BIOS/UEFI). It usually is; if the install fails with a virtualization error, that is the setting to look for.
- An administrator account for the first install.
Install with one command
Open PowerShell or Windows Terminal as administrator (right-click the Start button and pick the Terminal (Admin) entry), then run:
wsl --install
This turns on the required Windows features, downloads the Linux kernel, sets WSL2 as the default and installs Ubuntu. Careful: it enables the Virtual Machine Platform feature and asks you to restart. To remove everything later, unregister the distribution with wsl --unregister Ubuntu and turn off the features again under Windows Features.
After the restart, Ubuntu opens on its own and finishes setting up. It asks for a Linux username and password. They are separate from your Windows account and the password is only used inside Ubuntu, for example with sudo.
Choose a different distribution
wsl --list --online # what is available
wsl --install -d Ubuntu-24.04 # a specific version
wsl --install -d Debian
wsl --list --verbose # what is installed, and which WSL version it uses
You can keep several distributions side by side. wsl --set-default Debian picks which one opens when you type wsl with no arguments.
Check you are on WSL2
wsl --status
wsl --list --verbose
wsl --set-version Ubuntu 2 # convert a WSL1 distribution
wsl --set-default-version 2 # for future installs
In the --verbose list the VERSION column should say 2. On an up-to-date Windows it always will; the conversion commands are only needed on machines that were set up years ago.
Keep WSL up to date
wsl --update # update WSL itself and the kernel
wsl --version # WSL, kernel and Windows build numbers
Inside Ubuntu, packages update the normal Linux way: sudo apt update && sudo apt upgrade.
Where the files are
- From Linux, your Windows drives are mounted under
/mnt/c,/mnt/dand so on.cd /mnt/c/Users/ana/Documentsworks, but it is slower than the Linux file system. - From Windows, the Linux files live at
\\wsl$\Ubuntu\home\anaor\\wsl.localhost\Ubuntu\home\ana. Windows Explorer shows a Linux entry in the sidebar. - Keep projects on the side that runs the tools. Code you build with Linux tools belongs in
/home, not on/mnt/c, orgit statusandnpm installwill feel sluggish. - Windows programs run from Linux:
explorer.exe .opens the current folder,code .opens it in VS Code (with the WSL extension),notepad.exe file.txtworks too.
Starting, stopping, removing
wsl # open the default distribution in the current terminal
wsl -d Debian # a specific one
wsl --shutdown # stop the VM and all distributions
wsl --terminate Ubuntu # stop one distribution
wsl --unregister Ubuntu # delete it, including all its files
Careful: --unregister deletes the distribution’s disk immediately and there is no undo. Before you run it, copy anything you want to keep, or make a full backup with wsl --export Ubuntu C:\backups\ubuntu.tar. The matching wsl --import restores it under any name you like.
Common first problems
- WslRegisterDistribution failed with error 0x80370102: virtualization is disabled in the firmware, or Hyper-V is blocked by another hypervisor. Enable VT-x/AMD-V in BIOS.
- The command hangs or the store download fails: run
wsl --install --web-downloadto fetch from GitHub instead of the Microsoft Store. - Ubuntu opens but has no network: see the entry on fixing WSL2 networking and DNS.
- Old wsl.exe: on Windows 10 the one-command installer needs the April 2021 updates or newer; run Windows Update first.
Official documentation
Did this work for you?
No votes yet. Be the first.
If it did not work, the report form below tells the editors what went wrong.
See also
- 0399 Fix: running scripts is disabled on this system (execution policy) PowerShell refuses to run .ps1 files until the execution policy allows it. The usual fix is RemoteSigned for your own user; here… Beginner · Fixes an error · Windows Article PowerShell · Windows administration 15 Oct 2026
- 0400 winget: install and update software from the command line winget is the package manager built into Windows. Search for a program, install it by id, update everything with one command and… Beginner · Step by step · Windows Article Installing languages & tools · Windows administration 15 Oct 2026
- 0401 Windows services, Task Scheduler and event logs from PowerShell Manage the three things Windows administrators touch most: query and restart services, create and inspect scheduled tasks, and search the event logs… Intermediate · Step by step · Windows Article PowerShell · Windows administration 15 Oct 2026
- 0402 Fix: WSL2 has no network or DNS does not resolve apt update hangs, ping works by IP but not by name, or nothing reaches the internet from Ubuntu while Windows is fine.… Intermediate · Fixes an error · Windows Article Windows administration · WSL 15 Oct 2026
- 0403 Work across Windows and WSL: files, paths and running tools from both sides WSL is most useful when Windows and Linux cooperate: open Linux folders in Explorer, run Windows programs from bash, convert paths with… Beginner · Step by step · Windows Article Basics · WSL 15 Oct 2026
- 0404 Find the largest folders on a drive with PowerShell Lists the biggest top-level folders under a path, with file counts and sizes in GB, so you can see where the disk… Beginner · Step by step · Linux, macOS, Windows Script PowerShell · Windows administration 15 Oct 2026
Repos in the wild
- Windows Terminal: tabs, panes and profiles for every shell on Windows microsoft/terminal Microsoft's modern terminal for Windows, with tabs, split panes, GPU rendering, Unicode and emoji support and profiles for PowerShell, cmd, WSL distributions and SSH connections. GitHub
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- Dominik +4,389 chars