How to Install and Configure WSL on Windows 11
In this article
You can install WSL on Windows 11 with a single command: open PowerShell as Administrator and run wsl --install. That command enables the required Windows features, downloads the latest Linux kernel, sets WSL 2 as the default, and installs Ubuntu. After a restart, you create a Linux username and password, and you are ready to use a full Linux environment inside Windows. This guide walks through the install, the first-run setup, and the configuration that makes WSL comfortable for daily use.
What You'll Need
- Windows 11 (any edition) with the latest updates installed.
- Administrator rights on the PC.
- Virtualization enabled in the BIOS/UEFI (usually on by default; needed for WSL 2).
- An internet connection for the initial download.
- About 1–2 GB of free disk space for the Linux distribution (more if you install large toolchains).
Step-by-Step
- Open PowerShell as Administrator. Right-click the Start button and choose Terminal (Admin) or Windows PowerShell (Admin). The menu label varies slightly by Windows build.
- Run the install command. Type
wsl --installand press Enter. This enables the Virtual Machine Platform and Windows Subsystem for Linux features, installs the WSL 2 kernel, and sets WSL 2 as the default version. It also installs Ubuntu as the default distribution. - Restart your PC when prompted. A restart is required for the Windows features to finish enabling. Save your work first.
- Let Ubuntu finish setting up. After the restart, Ubuntu may open automatically and complete its first-run configuration. If it does not, open Ubuntu from the Start menu.
- Create your Linux user. When prompted, enter a new UNIX username (lowercase, no spaces) and a password. This account is separate from your Windows account. The password is not shown as you type—that is normal.
- Update the Linux packages. In the Ubuntu terminal, run
sudo apt update && sudo apt upgrade -y. Enter the password you just created when asked. - Check the WSL version. Back in PowerShell, run
wsl --list --verbose(orwsl -l -v). Confirm your distribution shows VERSION 2. If it shows 1, runwsl --set-version Ubuntu 2. - Set a default distribution (optional). If you install more than one, use
wsl --set-default <DistroName>to choose which one opens by default. - Configure global settings. Create or edit
C:\Users\<YourName>\.wslconfigin a text editor to control memory, processors, and swap for all distributions. For example,[wsl2]followed bymemory=4GBlimits WSL to 4 GB of RAM. Save the file, then runwsl --shutdownin PowerShell to apply changes. - Configure per-distribution settings. Inside the Linux terminal, edit
/etc/wsl.confwithsudo nano /etc/wsl.conf. You can set options such as[boot]systemd=true(on recent WSL versions that support systemd) or[automount]enabled=true. Save with Ctrl+O, exit with Ctrl+X, then runwsl --shutdownfrom PowerShell and reopen the distribution. - Access Windows files from Linux. Your Windows drives are mounted under
/mnt/c,/mnt/d, and so on. From Linux,cd /mnt/c/Usersreaches your Windows user folders. - Access Linux files from Windows. In File Explorer, type
\\wsl$\in the address bar, or use the Linux icon in the Explorer sidebar. Your Linux home is under\\wsl$\Ubuntu\home\<username>. - Install Windows Terminal (recommended). Windows Terminal is the modern terminal host and handles WSL profiles well. Install it from the Microsoft Store if it is not already present, then open a WSL tab from its dropdown.
Common Mistakes
- Running the install command in a non-admin window.
wsl --installneeds elevation to enable Windows features. If it fails with an access error, reopen PowerShell as Administrator. - Skipping the restart. The features are not active until Windows restarts. Opening Ubuntu before the restart can produce confusing errors.
- Forgetting the Linux password. There is no password hint and no Windows-style reset. If you lose it, you must reset it from inside WSL as root (see Troubleshooting).
- Editing Linux files from Windows tools. Editing files inside the Linux filesystem with Windows apps can corrupt permissions or line endings. Keep code inside the Linux home directory and edit it with Linux tools, or store projects on the Windows side and access them via
/mnt/c. - Assuming WSL 1 is fine. Most modern tooling expects WSL 2. Check with
wsl -l -vand convert if needed. - Ignoring virtualization. If WSL 2 refuses to start, virtualization may be disabled in BIOS/UEFI. Enable Intel VT-x or AMD-V there.
Tips
- Use
wsl --updateperiodically to get the latest WSL kernel and features. - Keep projects in the Linux filesystem (for example
~/projects) for much faster file operations than working under/mnt/c. - Use
wsl --shutdownwhen you change.wslconfigorwsl.conf; settings are only read at startup. - Install a terminal multiplexer or use Windows Terminal tabs to keep multiple Linux sessions organized.
- Back up important Linux files by copying them to a Windows folder; WSL distributions can be exported with
wsl --export <Distro> <file.tar>.
Troubleshooting
If wsl --install fails, first confirm you are in an Administrator PowerShell window and that Windows is fully updated. Run wsl --status to see the current state. If WSL 2 reports that virtualization is not enabled, enable Intel VT-x or AMD-V in BIOS/UEFI and try again.
If Ubuntu opens but immediately closes, run wsl --shutdown from PowerShell, then reopen it. If the distribution is missing from the list, run wsl --list --online to see available distributions and wsl --install -d <DistroName> to install one.
If you forget your Linux password, open PowerShell and run wsl -u root to enter as root, then use passwd <username> to set a new password. This requires that the distribution is working and that you have not disabled root access.
If networking fails inside WSL, run wsl --shutdown and reopen. Check that Windows is not blocking the virtual network adapter in security software. For DNS issues, verify /etc/resolv.conf is being generated; recent WSL versions manage this automatically.
If File Explorer does not show the Linux entry, ensure the distribution is running at least once. The \\wsl$\ path works even when the sidebar shortcut is missing.
Frequently Asked Questions
Do I need a separate Linux installation or virtual machine?
No. WSL runs a real Linux kernel in a lightweight virtualized environment managed by Windows. You do not install a full VM or dual-boot.
Can I install more than one Linux distribution?
Yes. Use wsl --list --online to see options, then wsl --install -d <DistroName>. Switch between them with wsl -d <DistroName> or set a default with wsl --set-default.
Where are my Linux files stored?
They live inside the WSL virtual disk, accessible from Windows through \\wsl$\ or the Linux node in File Explorer. Avoid moving or editing them with Windows tools that do not preserve Linux permissions.
Does WSL 2 require Hyper-V?
WSL 2 uses the Virtual Machine Platform feature, not the full Hyper-V management tools. Enabling wsl --install handles the required components.
How do I uninstall a distribution?
Run wsl --uninstall <DistroName> in PowerShell. This removes the distribution and its files; back up anything important first.
Can I run graphical Linux apps?
Recent WSL versions support GUI apps through WSLg on Windows 11. Install the app inside Linux and launch it from the terminal; it appears as a Windows window. Support depends on your Windows build and WSL version.