Get Started
Of course, from an Administrator PowerShell terminal:
1# Update WSL first
2wsl --update
3
4# Install the distribution you want
5wsl --install -d Ubuntu
6
7# List the distributions available for installation
8wsl --list --online
9
10# List all installed WSL distributions
11wsl --list
12wsl --list -v
13
14# If needed, reinstall a distribution
15wsl --shutdown
16wsl --unregister Ubuntu
Be careful with wsl --unregister: it removes the distribution and its data.
Windows Terminal
WSL gives you a Linux environment on Windows, and you can also use Windows Terminal for a more comfortable command-line experience.
Here are some useful shortcuts in Windows Terminal โ and a few Windows shortcuts as well ๐:
Alt + Enter: full-screen modeCtrl + Shift + T: open a new terminal tabCtrl + Shift + N: open a new windowCtrl + Alt + 1/2/3: switch between configured profilesWindows + V: open the clipboard historyAlt + Shift + =: split the pane verticallyAlt + Shift + -: split the pane horizontallyAlt + Arrow: switch between panesAlt + Shift + Arrow: resize the current panecode .: open VS Code from the current directory
Free some space on your WSL
- Check which directories contain the most data:
1du -h --max-depth 1
Enable the Hyper-V module in Windows Features:
Go to Control Panel โ Turn Windows features on or off โ enable Hyper-V โ restart Windows.
This is required to use the
Optimize-VHDcommand.Let’s shrink the virtual disk. Run PowerShell as Administrator:
1wsl --shutdown
2
3# Find ext4.vhdx under:
4# C:\Users\<USER>\AppData\Local\Packages\
5
6Optimize-VHD -Path C:\Users\<USER>\AppData\Local\Packages\AlmaLinuxOSFoundation.AlmaLinux8WSL_xxxxxxxxxxxxxx\LocalState\ext4.vhdx -Mode Full
Export/Import your WSL
1wsl --export AlmaLinux-8 AlmaLinux-8-full.tar
2wsl --import AlmaLinux8-full C:\Users\<USER>\AppData\Local\Packages\Alma8-full .\AlmaLinux-8-full.tar
3wsl -d AlmaLinux8-full -u <USER>
4wsl --unregister AlmaLinux8-full
5
6wsl --list -v
This is useful if you want to back up a distribution, move it, or recreate it under a different name.
Activate Systemd
You need WSL 2 and a recent enough WSL version.
Add the following lines at the top of /etc/wsl.conf:
1# /etc/wsl.conf
2[boot]
3systemd=true
Then restart WSL:
1wsl --shutdown
Install KVM on WSL
First, you need systemd enabled.
Inside
%USERPROFILE%\.wslconfig:
1[wsl2]
2nestedVirtualization=true
- Restart WSL:
1wsl.exe --shutdown
Then install and check KVM support:
1sudo apt update
2sudo apt install cpu-checker
3sudo kvm-ok
4
5# Basic packages
6sudo apt -y install libvirt-daemon-system bridge-utils qemu-kvm libvirt-daemon
7
8# Extra tools
9sudo apt install virtinst libosinfo-bin virt-top libguestfs-tools
10sudo apt install xsltproc uidmap
11
12# GUI tools
13sudo apt -y install qemu-system virt-manager
14
15sudo addgroup kvm
16sudo adduser "$(id -un)" libvirt-qemu
17sudo adduser "$(id -un)" kvm
18newgrp libvirt
Make Podman engine and Kind work on WSL2
- Adapt
%USERPROFILE%\.wslconfigto use systemd and cgroup v2:
1[wsl2]
2nestedVirtualization=true
3kernelCommandLine = cgroup_no_v1=all systemd.unified_cgroup_hierarchy=1
- Update the UID map and Podman user configuration:
1# Rootless Podman 4.9.3 on WSL2 + Ubuntu 24.04
2sudo apt-get install uidmap
3
4echo "ubuntu:100000:2097152" | sudo tee /etc/subuid
5echo "ubuntu:100000:2097152" | sudo tee /etc/subgid
6
7mkdir -p "$HOME/.config/containers"
8
9cat << EOF > "$HOME/.config/containers/containers.conf"
10unqualified-search-registries=["docker.io"]
11
12[aliases]
13"library"="docker.io/library"
14
15[engine]
16cgroup_manager = "cgroupfs"
17events_logger = "journald"
18EOF
Replace ubuntu with your actual Linux user if needed.
- Install Kind:
1[ "$(uname -m)" = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64
2chmod +x ./kind
3sudo mv ./kind /usr/local/bin/kind
Make WSL use the host network configuration
This is useful when switching between Wi-Fi networks.
Add the following to %USERPROFILE%\.wslconfig:
1[wsl2]
2networkingMode=mirrored
3dnsTunneling=true
4autoProxy=true
Then restart WSL:
1wsl --shutdown
Post-scriptum
This article was originally written in May 2025, and it reflects the WSL configuration and workarounds I was using at that time.
WSL evolves quickly, so some settings may become unnecessary or enabled by default in newer versions.
In particular:
- systemd support may already be enabled depending on the distribution
nestedVirtualization=truemay already be the default on supported systems- recent Podman versions may work without forcing
cgroupfs - cgroup v2 support has improved over time
- WSL networking behavior continues to evolve
So I would treat the commands above as a record of a working setup from that period rather than as a universal configuration for every current WSL installation.
The main idea, however, remains the same:
WSL is a very practical way to keep a Linux-first workstation while still working inside a Windows environment.




