WSL2 (Windows Subsystem for Linux 2) runs Linux directly inside Windows, without dual-boot (two systems installed side by side, chosen at startup) and without a heavy virtual machine to manage. You keep Windows as it is, and you get a Linux terminal with bash and the command-line tools of Linux (grep, sed, ssh, git), as they run on a server. This page takes a Windows PC to an open Ubuntu window, with your user created and the system up to date. On Windows 11, a single command is enough; Windows 10 is still supported by WSL, with the limits pointed out in the prerequisites. For a full Linux in its own virtual machine, see
Install Linux in a virtual machine instead.
What you will learn
This guide walks you through the installation and configuration of WSL2, from the limits of the tool to VS Code, by way of the prerequisites and the graphical applications:
| Skill | What you will be able to do |
|---|---|
| Know the limits | Know what WSL does not let you observe or practise |
| Check the prerequisites | Confirm that your PC supports WSL2 |
| Turn on virtualisation | Configure the BIOS if needed |
| Install WSL2 | One command to set everything up |
| Open Ubuntu | Create your Linux user and update the system |
| Choose a distribution | Ubuntu by default, or another one from the Microsoft catalogue |
| Offline installation | Install WSL without an Internet connection |
| Manage your distributions | List, stop, back up and restore |
| Run graphical apps | Run Linux applications with an interface |
| Tune WSL | Limit memory with .wslconfig, turn on systemd with wsl.conf |
| Work with VS Code | Open a project of the distribution from VS Code |
Understanding WSL2
Before typing a single command, you need to know which of the two versions of WSL you are using. The choice is made distribution by distribution, and it changes both performance and compatibility. This section compares the two architectures, then explains why the recommendation almost always leans the same way.
WSL1 vs WSL2: what is the difference?
WSL1 and WSL2 coexist and are chosen distribution by distribution. WSL1 translates Linux system calls into Windows calls. WSL2 embeds a real Linux kernel in a lightweight virtual machine managed by Hyper-V, the Windows hypervisor (the software that runs virtual machines).
| Aspect | WSL1 | WSL2 |
|---|---|---|
| Architecture | Translation layer | Real Linux kernel |
| Read/write (I/O) of Linux files | Average | High |
| Read/write (I/O) of Windows files | High | Average |
| Compatibility | Partial | Near-total |
| RAM used | Minimal | Dynamic (up to 50% of the RAM by default) |
The two performance rows read as mirror images. WSL1's translation reads Windows files fast but Linux files slowly. WSL2's virtual machine does the opposite, because its Linux files live in a virtual disk and access to C: goes through a network protocol.
Use WSL2 unless you work mostly on files stored on the Windows side: in that case, WSL1 can remain faster for file access.
WSL2 embeds a Linux kernel built and distributed by Microsoft. Linux applications find there what they expect, hence the near-total compatibility. Tools that rely on the kernel benefit from it: Docker Desktop, for example, uses the WSL 2 engine to run Linux containers on Windows.
What does WSL not allow when learning Linux administration?
WSL2 is fine for learning the shell, files, packages, SSH or Git, but it does not replace a real virtual machine for the server administration lessons of this course. Microsoft provides the kernel and manages the startup: several things that a server does, and that the course teaches, stay out of reach.
| What the course teaches | What WSL does with it |
|---|---|
| Startup: the firmware (the motherboard's program) launches GRUB (the boot loader), which loads the kernel and the initramfs (a small temporary system loaded into memory at the start) | Nothing to observe as on a server: Windows launches the Linux kernel in a lightweight virtual machine, without this sequence |
| Partitioning and LVM (resizable logical volumes) | No real partitioning: the distribution lives in a single virtual disk |
| A server's network | By default, WSL2 sits behind Windows in NAT mode: a private address provided by Windows, no direct access from another computer on the network |
The dsoxlab labs with virtual machines, the tool that plays the course labs | They are played in a VM, not in WSL; on Windows, no hypervisor combination is validated to date for these labs |
For these topics, create a virtual machine by following
Install Linux in a VM.
The paragraph "What about the dsoxlab labs?" of
that same lesson
says which hypervisors were tested with dsoxlab, and that nothing is validated
on Windows for the labs with virtual machines. Keep WSL for everyday command-line
work, and the VM for everything that touches startup, disks and network.
Prerequisites
Two conditions decide everything else: a recent enough Windows version, and hardware virtualisation turned on in the firmware. Check both before starting the installation.
Required Windows version
WSL2 works on Windows 11, or on Windows 10 version 2004 or later. The number that matters is not "Windows 10" but the build number: a machine still on a build older than 19041 refuses the wsl --install command, even though it does show Windows 10. To read it, press Win+R, type winver and confirm (the command also works in a terminal):
winverYou must see at least:
- Windows 11: every supported version
- Windows 10: version 2004 (build 19041 or later)
Windows 10 has no longer been supported by Microsoft since 14 October 2025: only the Extended Security Updates (ESU) programme still provides fixes, until 12 October 2027 for individuals (pages read on 2026-11-13). WSL itself still lists Windows 10 among the supported versions. For a new machine, prefer Windows 11.
Turn on virtualisation (BIOS/UEFI)
WSL2 relies on the Windows feature "Virtual Machine Platform", a subset of Hyper-V that is also available on Windows Home. It requires the processor's hardware virtualisation (Intel VT-x or AMD-V). On most recent PCs it is already turned on: check before touching the BIOS. Open Task Manager (Ctrl+Shift+Esc), Performance tab, then CPU: the Virtualization line must show "Enabled".
If it shows "Disabled", or if the installation fails with a virtualisation error, turn it on in the BIOS/UEFI. This is the settings menu of the motherboard, which opens at startup before Windows.
-
Restart your PC and enter the BIOS/UEFI
The key depends on the manufacturer (it is shown at startup); the table in the next step gives the most common ones.
-
Find the virtualisation setting
Its name and location vary by manufacturer:
Manufacturer BIOS key Location Setting name ASUS F2 / Del Advanced → CPU Configuration Intel VT-x / SVM Mode Dell F2 Virtualization Support Enable Virtualization HP F10 / Esc System Configuration → Device Configuration Virtualization Technology Lenovo F1 / F2 Security → Virtualization Intel VT-x / AMD-V MSI Del OC → CPU Features SVM Mode / Intel VT-x Acer F2 Advanced Intel VT / AMD SVM Gigabyte Del M.I.T → Advanced CPU Settings SVM / VT-x This table sums up the most common paths. The setting must be on Enabled.
-
Save and restart
Usually F10 → Save & Exit.
Installing WSL2
Two paths lead to the same result, and the choice depends on your network
access. On a connected machine, wsl --install chains on its own the feature
activation, the kernel download and the installation of a distribution. Behind a
filtering proxy or on an isolated machine, the same sequence is redone by hand,
file by file. Start with the standard method: the offline method only makes
sense if this one fails at download time.
Standard method (with Internet)
A single PowerShell command run as administrator turns on the Windows features, downloads the kernel and installs a distribution. Five steps take you from a blank PC to an open Ubuntu window. The point not to miss is the restart between step 2 and step 4: Microsoft asks you to restart the PC after wsl --install, and the installation of Ubuntu continues at that restart.
-
Open PowerShell as administrator
- Right-click Start → Windows Terminal (Admin)
- Or: Win+X → Terminal (Admin)
-
Start the installation
Terminal window wsl --installThis command:
- Turns on the required Windows features
- Downloads the WSL2 Linux kernel
- Installs Ubuntu as the default distribution
-
Restart your PC
Terminal window Restart-Computer -
Set up Ubuntu on first launch
After the restart, Ubuntu starts by itself and finishes its installation, which takes a few minutes. If no window opens, type Ubuntu in the Start menu and click the application. Ubuntu asks you to create your Linux user, then a password. When you type the password, nothing is displayed, not even dots: this is normal. Type it anyway, then confirm it. Remember it, because Linux will ask for it again.
Enter new UNIX username: your_nameNew password:Retype new password: -
Check the prompt and update Ubuntu
When the installation is finished, the window shows a prompt like
your_name@PC:~$: your user, the name of your PC, then the current directory. You are in a Linux terminal. Update the packages before going on. Thesudocommand asks for your password, again without displaying anything:Terminal window sudo apt update && sudo apt upgrade -yTo reopen Ubuntu after closing it, type Ubuntu in the Start menu, or
wslin PowerShell. The lesson Open a terminal and understand the prompt explains how to read this prompt.
To check that Ubuntu runs on WSL2, open PowerShell and run wsl --list --verbose: the VERSION column must show 2.
Ubuntu is only the default distribution, not a requirement. The -d option installs
another one, and you can install several side by side on the same machine:
wsl --install -d DebianThe wsl --list --online command shows the catalogue of names accepted by -d.
It is the only authoritative list: a name found elsewhere fails if the image is
not published for your WSL version. If the download stays stuck at 0.0%,
Microsoft advises wsl --install --web-download -d <Distribution>.
Offline method (without Internet)
In a disconnected environment or behind a filtering proxy, wsl --install fails when downloading the kernel. The procedure below redoes by hand what the command automates: turn on two Windows features, install the WSL package, then provide the distribution as a file. Microsoft documents it under the title Manual installation steps for older versions of WSL. Plan a connected machine to fetch the two files, and a means of transfer (USB stick, internal share).
-
Turn on the required Windows features
In an administrator PowerShell:
Terminal window dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart -
Restart
Terminal window Restart-Computer -
Download the WSL package
On a connected PC, download the MSI package for your architecture from the releases of the microsoft/WSL repository, for example
wsl.3.0.5.0.x64.msi(version read on 2026-11-16). Transfer it, then install it by double-clicking or withmsiexec /i. This MSI is the modern WSL: it bringswsl --version, systemd and WSLg.Avoid
wsl_update_x64.msi, which the Microsoft Manual installation steps page still cites: it only updates the kernel of the WSL shipped in Windows, and with itwsl --versionis not recognised and systemd stays unavailable. -
Make WSL2 the default version
Terminal window wsl --set-default-version 2 -
Install a distribution manually
A distribution's Microsoft Store page does not let you download its package. Take the direct link published in the Downloading distributions section of the same page, for example for Ubuntu and Debian. For Ubuntu, that list offers the 24.04 LTS, 22.04 LTS and 20.04 LTS versions. The example downloads 24.04 LTS:
Terminal window Invoke-WebRequest -Uri https://wslstorestorage.blob.core.windows.net/wslblob/Ubuntu2404-240425.AppxBundle -OutFile Ubuntu.AppxBundle -UseBasicParsingInvoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile Debian.appx -UseBasicParsingOn the target machine, install the package:
Terminal window Add-AppxPackage .\Ubuntu.AppxBundleThe distribution then appears in the Start menu. Launch it to create your user, as in step 4 of the standard method.
On Windows Server,
Add-AppxPackageis not suitable (it does not work on Server Core). Microsoft Learn (Install on Windows Server) extracts the package withtar, then runs the distribution's program:Terminal window mkdir Ubuntutar -xf .\Ubuntu.AppxBundle -C .\UbuntuThen run
<Distro>.exefrom that folder (for exampleUbuntu.exe). On Windows Server 2022 and 2025,wsl.exe --installis enough and avoids this step; Windows Server 2019 (from version 1709) goes through the manual installation.
Essential commands
Here are the PowerShell commands you will need day to day. They all run from a Windows terminal, not from inside WSL: they can therefore act on a stopped distribution.
Managing distributions
Once WSL is installed, you can have several Linux distributions side by side. These commands list them, start them, stop them or change the default distribution, each one by its name.
# List the installed distributionswsl --list --verbose
# Start a specific distributionwsl -d Ubuntu
# Set the default distributionwsl --set-default Ubuntu
# Stop every distributionwsl --shutdown
# Stop a specific distributionwsl --terminate UbuntuManaging WSL versions
You can convert an existing distribution from WSL1 to WSL2 (or the other way round) without reinstalling it. It is useful if you migrated from an older version of Windows.
# Show the version information of WSL and its components# (if the command fails, update WSL with wsl --update)wsl --version
# Convert a distribution WSL1 → WSL2wsl --set-version Ubuntu 2
# Update WSLwsl --updateAccessing files
The file systems are reachable from both sides. On the Windows side, two paths
lead to the distribution: \\wsl.localhost\ and the older \\wsl$\. They point
to the same place, and the distribution must be running. The table gives the
first one:
| From | To | Path |
|---|---|---|
| Windows | Linux | \\wsl.localhost\Ubuntu\home\user\ |
| Linux | Windows | /mnt/c/Users/YourName/ |
Linux graphical applications
WSL2 runs Linux graphical applications thanks to WSLg, a component that starts together with the distribution and relays the display to the Windows desktop. A Linux window appears like an ordinary Windows window, with its entry in the taskbar. There is no third-party X server to install, and no variable to export.
Microsoft Learn sets the prerequisite: Windows 11 or Windows 10 build 19044 or later, an up-to-date WSL, and the manufacturer's graphics driver (Intel, AMD or NVIDIA) installed on the Windows side.
Checking support
WSLg provides in the distribution a Wayland display server and an X11 bridge (two Linux display systems, which graphical applications use depending on their age). To test it, read the DISPLAY variable: if it is empty, WSLg is not active and no window will open, whatever package is installed. One possible cause is a WSL that is too old, which wsl --update fixes.
# In WSL2, check that DISPLAY is setecho $DISPLAY# Must show something like :0Installing a graphical application
A Linux graphical application installs like a command-line application, with the distribution's package manager. No display configuration is needed. Updating the package index first (apt update) avoids installing an outdated version, and apt install adds on its own the GTK or Qt libraries the application depends on.
# Update the packagessudo apt update && sudo apt upgrade -y
# Install a graphical editor (example: GNOME Text Editor)sudo apt install gnome-text-editor -y
# Start the applicationgnome-text-editor &The application opens in a classic Windows window, integrated into the taskbar.
Common applications
Here are a few common graphical applications to install in WSL2. They integrate with Windows: icons in the Start menu, resizable windows, copy and paste between Windows and Linux.
# File browsersudo apt install nautilus -y
# Code editor (lightweight)sudo apt install geany -y
# Advanced terminalsudo apt install terminator -yAfter installation, start each application by its name in the WSL terminal, for
example nautilus &. The ampersand & gives control back to the terminal
instead of blocking it while the window stays open.
The terminal is not needed afterwards: these applications appear in the Windows
Start menu, among the Windows applications, and can be pinned to the
taskbar like any of them. WSLg publishes these shortcuts from the .desktop
files installed by the package.
Advanced configuration
Two configuration files coexist, and it is easy to mix them up. The diagram
shows where each one lives: .wslconfig is a single Windows file that sets the
virtual machine shared by all distributions; each distribution has its own
/etc/wsl.conf, which only concerns that one.
Remember the split rule: everything about the memory, processors and network of the VM is global, everything about systemd and mounts is local.
Limiting resources (.wslconfig)
By default, the WSL2 virtual machine can use up to 50% of the host's memory, plus a swap of 25% of that memory. The .wslconfig file sets a ceiling, which prevents a build in WSL from slowing down the rest of the machine. It applies to all distributions at once, unlike wsl.conf covered just after. Recent versions also offer the WSL Settings application, in the Start menu, which writes this same file.
The file is created at this location: C:\Users\YourName\.wslconfig
[wsl2]memory=4GBprocessors=2swap=2GBlocalhostForwarding=trueAfter a change, restart WSL:
wsl --shutdownPer-distribution configuration (wsl.conf)
Where .wslconfig sets the global virtual machine on the Windows side, /etc/wsl.conf sits inside each distribution and only concerns that one. It is the file that turns on systemd, the Linux service manager. Microsoft states that many distributions, Ubuntu included, start it by default. On a distribution that does not turn it on, without this setting, systemctl returns an error and no Linux service starts at launch.
The [boot] section and the systemd=true setting require a recent WSL, version 0.67.6 or later (Microsoft Store or MSI package), with no restriction to Windows 11. If wsl --version fails, update WSL with wsl --update. Create the file with root rights:
[boot]systemd=true
[automount]enabled=trueroot=/mnt/options="metadata,umask=22,fmask=11"
[network]generateResolvConf=trueThis configuration:
- Turns on systemd (Linux services)
- Sets up the automatic mounting of Windows drives
- Generates
/etc/resolv.confautomatically
VS Code integration
VS Code works here in client-server mode: the interface stays a Windows application, but a VS Code server is installed automatically in the Linux distribution, and it is the one that runs the terminal, the extensions, the debugger and the language tools. Practical consequence: extensions must be installed on the WSL side, and an extension present on the Windows side may appear greyed out until you turn it on in the remote context.
-
Install the WSL extension
In VS Code, install the extension named "WSL", published by Microsoft (identifier
ms-vscode-remote.remote-wsl). -
Open a WSL project
From WSL:
Terminal window cd ~/my-projectcode .Or from VS Code:
Ctrl+Shift+P→ "WSL: Connect to WSL" -
Develop natively
VS Code runs on the Windows side but every tool (terminal, extensions) runs in WSL.
Troubleshooting
The WSL failures covered here fall into three families: virtualisation missing or
turned off, an outdated component that wsl --update brings up to date, and a
distribution whose internal state is broken. The "Common errors" subsection
mostly handles the first two with a lookup table. The third is fixed by the
reset, which destroys data and must therefore be prepared before running it.
Common errors
The first column sums up messages whose exact wording varies with the WSL version and the Windows language: look for the keyword (virtualization, update, elevation) in what your terminal shows. The first three errors are fixed outside the distribution (BIOS, rights, WSL update). The fourth concerns the installation of Ubuntu itself. The fifth changes the configuration of the virtual machine: it needs a wsl --shutdown before the fix takes effect. The last one is a matter of network and VPN.
| Error | Likely cause | Solution |
|---|---|---|
| "Virtualization disabled" | BIOS badly configured | Turn on VT-x/AMD-V in the BIOS |
| "WSL 2 requires an update" | Outdated kernel | wsl --update |
| "The requested operation requires elevation" | Insufficient rights | Run PowerShell as admin |
| No Ubuntu window after the restart | The installation of Ubuntu did not finish | Type Ubuntu in the Start menu; otherwise run wsl --install -d Ubuntu again |
| Distribution that does not start | Not enough RAM on the Windows host | Lower memory in .wslconfig |
| Network unavailable | VPN interference | Turn off the VPN or configure the firewall |
Resetting a distribution
If a distribution is corrupted, the only reset goes through unregistering it, which wipes everything: export what matters first.
# Unregister (deletes the data!)wsl --unregister Ubuntu
# Reinstallwsl --install -d UbuntuExporting/importing a distribution
wsl --export produces a .tar archive holding the distribution's whole file system: installed packages, personal files, configuration. It is the backup mechanism provided as standard, and it serves as much to migrate to another machine as to move a distribution to another disk when C: fills up. On import, the second argument is the destination directory of the virtual disk, not a file: give an empty folder.
# Back upwsl --export Ubuntu D:\Backups\ubuntu.tar
# Restore (on another PC or after a reinstall)wsl --import Ubuntu C:\WSL\Ubuntu D:\Backups\ubuntu.tarInstallation checklist
Use this list to confirm that your WSL2 installation is complete and working. Each item matches a step not to skip.
- Windows 11, or Windows 10 2004+
- Virtualisation turned on in the BIOS
-
wsl --installrun successfully - Distribution set up (user + password)
- Ubuntu open,
your_name@PC:~$prompt visible, packages updated -
wsl --list --verboseshows the distribution in version 2 - Working network access (
sudo apt updatesucceeded in step 5) -
.wslconfigcreated to limit RAM (optional)
Key points
These points sum up what to keep in mind to use WSL2 day to day, from installation to backup.
| Concept | Key point |
|---|---|
| WSL2 | A real Linux kernel in a lightweight virtual machine, not an emulation |
| Installation | wsl --install does everything in one command, then the PC restarts |
| First launch | User created, password invisible as you type it, packages updated with sudo apt update && sudo apt upgrade -y |
| Files | Work in your app's native file system |
| Resources | Limit RAM through .wslconfig if needed |
| Graphical applications | WSLg, on Windows 11 or Windows 10 build 19044+ |
| VS Code | WSL extension to develop natively |
| Limits | No startup to observe, no partitioning, network behind NAT: for these lessons, use a virtual machine; the dsoxlab labs with VMs are validated on Windows with no hypervisor |
| Backup | wsl --export before any risky operation |
Knowledge check
Check that the essentials of this page stuck. The questions only cover what has just been explained here.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Identify your Linux system
Continue the course: Open a terminal and understand the prompt
A new full quiz with random questions
Work again only on the questions you missed
FAQ: frequently asked questions
These questions come up often after a first installation, and they cover points the guide handles in different places: the choice between WSL1 and WSL2, access to Windows files from Linux and the use of Docker in the distribution.
Architecture
┌─────────────────────────────────┐
│ Linux applications │
├─────────────────────────────────┤
│ Linux kernel (real) │
├─────────────────────────────────┤
│ Lightweight virtual machine │
├─────────────────────────────────┤
│ Windows (Hyper-V) │
└─────────────────────────────────┘
Key features
- Real Linux kernel: full compatibility with Linux applications
- Performance: fast access to the Linux file system
- Windows integration: access to Windows files from Linux and vice versa
- GUI applications: support for Linux graphical applications on Windows 11 and Windows 10 build 19044+
Use cases
- Development: a Linux environment without leaving Windows
- DevOps: Docker, Ansible, Terraform on Windows
- Training: learn Linux without dual-boot
Comparison
| Aspect | WSL 1 | WSL 2 |
|---|---|---|
| Architecture | Translation layer (syscalls) | Real Linux kernel in a lightweight VM |
| Compatibility | Partial (system call translation) | Complete (real Linux kernel) |
| Linux FS performance | Slow | Fast (native) |
| Windows FS performance | Fast | Slower (9P protocol) |
| Memory | Shared with Windows | VM with dynamic allocation |
| GUI applications | No | Yes (Windows 11, Windows 10 build 19044+) |
When to choose WSL 1?
- Projects stored on the Windows disk (
/mnt/c/) - Limited memory resources
When to choose WSL 2? (recommended)
- Linux development: compiling, testing
- Containers: Docker, Podman
- GUI applications: VS Code Remote, GIMP
- Maximum compatibility: every Linux tool
Command to change version
# Switch a distribution to WSL 2
wsl --set-version Ubuntu 2
# Make WSL 2 the default
wsl --set-default-version 2
Method 1: Task Manager (simple)
- Open it with Ctrl + Shift + Esc
- Performance tab → CPU
- Look for the Virtualization line
| Value | Meaning |
|---|---|
| Enabled | Ready for WSL 2 |
| Disabled | Turn it on in the BIOS |
Method 2: PowerShell (detailed)
# Check Hyper-V support
Get-ComputerInfo | Select-Object HyperV*
# Expected result
HyperVisorPresent : True
HyperVRequirementVirtualizationFirmwareEnabled : True
Method 3: systeminfo command
systeminfo | Select-String "Hyper-V"
# Expected result: every line set to "Yes"
Hyper-V Requirements: Yes
If virtualisation is disabled
You must turn it on in your machine's BIOS/UEFI (see the next question).Step 1: Enter the BIOS/UEFI
| Brand | Key(s) at startup |
|---|---|
| ASUS | F2 or DEL |
| Acer | F2 or DEL |
| Dell | F2 or F12 |
| HP | ESC or F10 |
| Lenovo | F2 or F1 (ThinkPad: Enter + F1) |
| MSI | DEL |
| Samsung | F2 |
Step 2: Find the virtualisation option
| Processor | Option name |
|---|---|
| Intel | Intel Virtualization Technology (VT-x) |
| AMD | AMD-V or SVM Mode |
Advanced Settings→CPU ConfigurationSecurity→VirtualizationBIOS Features→Intel VT-x
Step 3: Turn it on and save
- Set the value to Enabled
- Press F10 (Save & Exit)
- Restart the PC
Check after the restart
# Must return "True"
(Get-CimInstance Win32_Processor).VirtualizationFirmwareEnabled
Quick installation (recommended)
# Open PowerShell as Administrator
# Install WSL + Ubuntu by default
wsl --install
This command:- Turns on the required Windows features
- Downloads the WSL 2 Linux kernel
- Installs Ubuntu from the Microsoft Store
Choose another distribution
# List the available distributions
wsl --list --online
# Install a specific distribution
wsl --install -d Debian
wsl --install -d kali-linux
wsl --install -d Ubuntu-24.04
Popular distributions
| Distribution | Command | Use |
|---|---|---|
| Ubuntu | wsl --install -d Ubuntu |
General, development |
| Debian | wsl --install -d Debian |
Servers, stability |
| Kali Linux | wsl --install -d kali-linux |
Security, pentesting |
| Arch Linux | Manual installation | Advanced users |
| AlmaLinux | wsl --install -d AlmaLinux-9 |
RHEL alternative |
After installation
# First launch: create a user
wsl
# Enter a user name and password
# Update the packages
sudo apt update && sudo apt upgrade -y
Step 1: Turn on the Windows features
# PowerShell as Administrator
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Restart required
Restart-Computer
Step 2: Install the WSL package
Download the WSL MSI package published by Microsoft in the releases of the microsoft/WSL repository, for examplewsl.3.0.5.0.x64.msi (or wsl.3.0.5.0.arm64.msi).# After downloading (adapt the name to the downloaded file)
msiexec /i wsl.3.0.5.0.x64.msi /quiet
This package brings wsl --version, systemd and WSLg. The wsl_update_x64.msi file from the Manual installation steps page only updates the kernel of the WSL shipped in Windows.Step 3: Make WSL 2 the default
wsl --set-default-version 2
Step 4: Download a distribution manually
From Microsoft Learn:| Distribution | File |
|---|---|
| Ubuntu 24.04 | Ubuntu2404-240425.AppxBundle |
| Debian | DebianGNULinux.appx |
Step 5: Install the distribution
On a Windows 10 or 11 (or LTSC) machine:# Copy the .appx file to the target machine
Add-AppxPackage -Path .\Ubuntu2404-240425.AppxBundle
# Then launch the distribution from the Start menu
On Windows Server, Add-AppxPackage is not suitable (it does not work on Server Core). Extract the package with tar -xf into a folder, then run <Distro>.exe:mkdir Ubuntu
tar -xf .\Ubuntu2404-240425.AppxBundle -C .\Ubuntu
.\Ubuntu\<Distro>.exe
On Windows Server 2022 and 2025, wsl.exe --install is enough and avoids this step.Check
wsl --list --verbose
# NAME STATE VERSION
# Ubuntu-24.04 Running 2
.wslconfig file configures the resources allocated to WSL 2 (memory, CPU, swap).File location
C:\Users\<YourName>\.wslconfig
Recommended configuration
[wsl2]
# Limit memory (default: 50% of RAM)
memory=8GB
# Limit processors (default: all)
processors=4
# Swap size
swap=4GB
# Network
networkingMode=mirrored # NAT or mirrored (Windows 11)
# DNS
dnsTunneling=true
[experimental]
# Reclaiming cached memory: dropCache (default), gradual or disabled
autoMemoryReclaim=gradual
sparseVhd=true
Important options
| Option | Description | Default |
|---|---|---|
memory |
Maximum RAM for WSL 2 | 50% of RAM |
processors |
Number of virtual CPUs | All |
swap |
Swap file size | 25% of RAM |
localhostForwarding |
Windows localhost → WSL access | true |
nestedVirtualization |
Nested VMs in WSL 2 (Windows 11) | true |
Apply the changes
# Stop WSL to apply
wsl --shutdown
# Start again
wsl
Graphical interface (Windows 11)
Recent WSL versions provide the WSL Settings application, opened from the Start menu: Microsoft recommends using it rather than editing the file by hand.Prerequisites
| Item | Required |
|---|---|
| Windows | Windows 11 or Windows 10 build 19044+ |
| WSL | Recent version (wsl --update) |
| GPU driver | Compatible Intel/AMD/NVIDIA |
Check support
# Update WSL
wsl --update
# Check the version
wsl --version
# The WSLg version must appear
Install a GUI application
# Update the packages
sudo apt update
# Install graphical applications
sudo apt install -y gimp # Image editor
sudo apt install -y firefox # Browser
sudo apt install -y nautilus # File manager
sudo apt install -y gnome-text-editor # Text editor
Start an application
# From the WSL terminal
gimp &
firefox &
# From Windows (Run dialog)
wsl gimp
Popular applications for WSL
| Application | Installation | Use |
|---|---|---|
| VS Code | code . (Remote-WSL) |
Development |
| GIMP | apt install gimp |
Image editing |
| Firefox | apt install firefox |
Web browsing |
| VLC | apt install vlc |
Media playback |
| LibreOffice | apt install libreoffice |
Office suite |
Troubleshooting
If GUI applications do not show up:# Check DISPLAY
echo $DISPLAY
# Must return :0 or similar
# Update the GPU driver
# Download it from the manufacturer's site (Intel/AMD/NVIDIA)
Recommended installation
- Install Docker Desktop from docker.com
- In Settings → General: turn on Use WSL 2 based engine
- In Settings → Resources → WSL Integration: turn on your distributions
Check
# From WSL
docker --version
docker info
Alternative: native Docker Engine in WSL
To avoid Docker Desktop (licence):Install Docker Engine from the official APT repository described in the Docker documentation (Install Docker Engine on Ubuntu), never with a script downloaded and run blindly, then:# Add the user to the docker group
sudo usermod -aG docker $USER
# Start the service and enable it at boot (systemd turned on in /etc/wsl.conf)
sudo systemctl enable --now docker
Best performance
| Tip | Explanation |
|---|---|
| Store projects in WSL | /home/user/projects/, not /mnt/c/ |
| Use named volumes | Avoid bind mounts to Windows |
| Allocate enough RAM | .wslconfig with memory=8GB at least |
docker-compose example in WSL
# Go to the Linux folder (not /mnt/c/)
cd ~/projects/my-app
# Start the services
docker compose up -d
# Access from Windows
# http://localhost:3000 (automatic port forwarding)
Access Windows from WSL
# Windows drives are mounted under /mnt/
ls /mnt/c/Users/
cd /mnt/c/Users/MyName/Documents
# Example: copy a file
cp /mnt/c/Users/MyName/file.txt ~/
Access WSL from Windows
# Through File Explorer
\\wsl$\Ubuntu\home\myuser
# Or from the address bar
\\wsl.localhost\Ubuntu
Performance best practices
| Situation | Recommendation |
|---|---|
| Linux dev project | Store it in ~/projects/ (native WSL) |
| Shared files | Use /mnt/c/ occasionally |
| Git clone | Always clone on the Linux side |
| npm/pip install | Run from the Linux FS |
Open VS Code from WSL
# Go to the project folder
cd ~/projects/my-app
# Open VS Code with Remote-WSL
code .
Copy between systems
# Windows → WSL
cp /mnt/c/Users/MyName/Downloads/file.zip ~/
# WSL → Windows
cp ~/report.pdf /mnt/c/Users/MyName/Documents/
# With Windows Explorer
explorer.exe . # Opens the current folder in Explorer
Performance
Access to the Linux file system from WSL 2 is the fastest; crossing the boundary, from Windows to WSL or from WSL to/mnt/c/, goes through a network protocol and costs much more.Golden rule: keep your projects in the file system where you work the most.Error: "WSL 2 requires an update to its kernel component"
# Update WSL and its kernel
wsl --update
Error: "The virtual machine could not be started"
# Check that the Virtual Machine Platform is on
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
# Restart
Restart-Computer
WSL uses too much memory
# Create/edit C:\Users\<Name>\.wslconfig
[wsl2]
memory=4GB
swap=2GB
[experimental]
autoMemoryReclaim=gradual
# Apply the changes
wsl --shutdown
The Internet does not work in WSL
# Check DNS
cat /etc/resolv.conf
To set DNS yourself, first turn off automatic generation in /etc/wsl.conf ([network] section, generateResolvConf=false), run wsl --shutdown from Windows, then write your own /etc/resolv.conf. Without this step, WSL rewrites the file at the next start.Reset a distribution
# Export important data first
wsl --export Ubuntu ubuntu-backup.tar
# Uninstall
wsl --unregister Ubuntu
# Reinstall
wsl --install -d Ubuntu
# Restore if needed
wsl --import Ubuntu C:\WSL\Ubuntu ubuntu-backup.tar
Diagnostic commands
# WSL status
wsl --status
# List distributions
wsl --list --verbose
# Stop every instance
wsl --shutdown
# Update WSL
wsl --update
# Check the version
wsl --version
Diagnostic table
| Symptom | Likely cause | Solution |
|---|---|---|
| Extreme slowness | Files on /mnt/c | Move them to ~/ |
| No network | Badly configured DNS | Fix resolv.conf (with generateResolvConf=false) |
| RAM saturated | No limit | Configure .wslconfig |
| Error at startup | Virtualisation disabled | Turn it on in the BIOS |