On this pageCheck the prerequisites
The Windows Subsystem for Linux gives you a real Linux environment on a Windows machine: Bash, apt, compilers, ssh and the same command-line tools your servers run. WSL 2 runs an actual Linux kernel inside a lightweight utility virtual machine that Windows manages for you, so there is no VM to configure, and after the first launch it starts in under a second. Microsoft open-sourced WSL in May 2025, and it now updates through its own package rather than through Windows releases. Here is how to install it and set it up so it stays fast and out of your way.
Check the prerequisites
You need Windows 11, or Windows 10 version 2004 (build 19041) or later. The winver command, typed into the Start menu search, shows the exact version and build. Hardware virtualization must be enabled in the firmware settings, which is the default on most recent machines.
A note on Windows 10: it reached end of support on October 14, 2025, and the one-year consumer Extended Security Updates program ended in October 2026. WSL still installs and runs there, but a machine you develop on every day should be on Windows 11.
Install with one command
Open PowerShell as administrator and run:
wsl --install
This enables the required Windows features and installs Ubuntu, the default distribution. Restart when asked. On first launch, the distribution unpacks itself and asks you for a Linux username and password. They are separate from your Windows account, and the password is what sudo will ask for.
To choose another distribution, list what is available and install by name:
wsl --list --online
wsl --install -d Debian
If an installation hangs at 0.0%, wsl --install --web-download -d Debian downloads the distribution first and usually gets past it.
Confirm you are on WSL 2
wsl --version
wsl -l -v
wsl --update
wsl -l -v lists installed distributions with their WSL version. New installations use WSL 2 by default. An old distribution still on WSL 1 converts with wsl --set-version Ubuntu 2, and wsl --set-default-version 2 makes sure future installs use it too.
First steps inside Linux
Update the distribution and install the basics most projects need:
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y build-essential git curl unzip
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global core.autocrlf input
The last line stops Git from converting line endings in ways that break shell scripts. Create an SSH key inside Linux with ssh-keygen -t ed25519 if you will push to Git servers or connect to remote machines from WSL; the Linux and Windows sides keep separate ~/.ssh directories.
Keep projects on the Linux side
This is the single biggest performance decision. Your Windows drives appear under /mnt/c, and they work, but file operations across that boundary are much slower than on the Linux file system. Microsoft recommends storing project files in the Linux file system when you work with Linux tools:
mkdir -p ~/code && cd ~/code
git clone https://github.com/example/project.git
explorer.exe . # open the current Linux folder in Windows Explorer
From Windows, the same files are reachable at \\wsl.localhost\Ubuntu\home\<user>\code. Package installs, builds and test runs that crawl through thousands of small files are where the difference shows most.
Tune WSL with two configuration files
WSL reads two files, with different scopes.
| File | Location | Scope | Typical settings |
|---|---|---|---|
wsl.conf |
/etc/wsl.conf inside a distribution |
That distribution only | systemd, default user, drive mounting, Windows paths |
.wslconfig |
%UserProfile%\.wslconfig on Windows |
All WSL 2 distributions | memory, processors, swap, networking mode |
To run services such as Docker Engine or a database the usual way, make sure systemd is on. Check /etc/wsl.conf, and add this if it is missing:
[boot]
systemd=true
By default, the WSL 2 virtual machine may use up to 50% of the computer's memory and every logical processor. On a 16 GB laptop running a browser and an IDE, capping it keeps Windows responsive:
[wsl2]
memory=6GB
processors=4
swap=4GB
Changes apply only after WSL fully stops. Run wsl --shutdown from PowerShell, then start your distribution again. Microsoft also recommends making these changes through the WSL Settings app in the Start menu, which writes the same file for you.
Run commands across the boundary
WSL and Windows can call each other's programs, which removes most of the friction of working in two systems. From PowerShell, prefix a Linux command with wsl; from Linux, call any Windows executable by its full name, including the .exe:
wsl ls -la # Linux command, current Windows folder
wsl -d Debian -- uname -a # run in a specific distribution
pwd | clip.exe # copy the current Linux path to the Windows clipboard
notepad.exe notes.txt # edit a Linux file in a Windows app
By default, WSL also appends the Windows PATH to the Linux one. That is convenient, but it can make command lookups slower and let a Windows tool shadow a Linux one with the same name. If that bites, set appendWindowsPath=false under [interop] in /etc/wsl.conf and call the few Windows tools you need by full path.
Networking basics
In the default NAT mode, a server listening inside WSL is reachable from Windows at localhost. Start a dev server on port 3000 in Linux and open http://localhost:3000 in a Windows browser; it just works.
On Windows 11 version 22H2 or later, networkingMode=mirrored under [wsl2] makes Linux share the Windows network interfaces instead. That improves IPv6 and VPN compatibility and lets other machines on your network reach services in WSL, subject to the Windows firewall.
Editors and containers
- VS Code: install the WSL extension, then run
code .inside a Linux folder. The editor runs on Windows while terminals, extensions and tools run in Linux. - JetBrains IDEs can open projects stored in WSL and use its toolchains.
- Containers: Docker Desktop can use WSL 2 as its backend, or you can install Docker Engine directly inside the distribution once systemd is enabled, following the same steps as the Docker Engine install guide.
Back up or move a distribution
A distribution is one virtual disk, so it exports to a single archive:
wsl --shutdown
wsl --export Ubuntu D:\backup\ubuntu.tar
wsl --import Ubuntu-Copy D:\wsl\ubuntu-copy D:\backup\ubuntu.tar
The same pair of commands moves a distribution to another drive or another computer. wsl --unregister <Distro> deletes a distribution and everything in it, so export first.
FAQ
WSL 1 or WSL 2?
WSL 2 for almost everything: full system call compatibility, Docker support and much faster Linux file operations. WSL 1 only makes sense for workflows that live entirely on Windows drives under /mnt.
Does WSL replace a Linux server?
No. It is a development environment that sleeps when you close the lid. For anything that must stay online, such as staging, bots or self-hosted tools, run it on a Linux VPS and use WSL as the terminal you connect from.
Can I run Linux GUI apps?
Yes, on Windows 11, through WSLg. Install a graphical application inside the distribution and launch it; its window appears on the Windows desktop.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




