1. Download and Install the Latest Kernel Component Package
-
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
2. Install the Virtual Machine Platform and Linux Subsystem, and Set Default Version
Run PowerShell as Administrator:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Then restart your computer and install a Linux distribution (e.g., Ubuntu)
Make sure the default version is set to 2:
wsl --set-default-version 2
Execution Result:
For information on key differences with WSL 2, visit https://aka.ms/wsl2
Operation completed successfully.
3. View Available Linux Distributions for Installation
wsl.exe --list --online
If this command does not respond, troubleshoot your network:
Reset Winsock and Network Components
netsh winsock reset
netsh int ip reset
ipconfig /flushdns
Restart the system
Executing <span>wsl.exe --list --online</span> should normally return:
The following is a list of valid distributions that can be installed.
The default distribution is indicated with "*".
Use 'wsl --install -d <Distro>' to install.
NAME FRIENDLY NAME
* Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_10 Oracle Linux 8.10
OracleLinux_9_5 Oracle Linux 9.5
openSUSE-Leap-15.6 openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed openSUSE Tumbleweed
4. Install the Linux Subsystem
wsl --install -d Ubuntu-22.04
Installation Process Example:
C:\Users\TANGXG>wsl --install -d Ubuntu-22.04
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tangxg
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.6.87.2-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Nov 20 11:27:19 CST 2025
System load: 0.0 Processes: 68
Usage of /: 0.1% of 1006.85GB Users logged in: 0
Memory usage: 3% IPv4 address for eth0: 172.20.90.116
Swap usage: 0%
This message is shown once a day. To disable it please create the
/home/tangxg/.hushlogin file.
5. Check if a Distribution is Installed
wsl -l -v
If the output is empty, it means no distribution is installed
Execution Result:
C:\Users\TANGXG>wsl -l -v
NAME STATE VERSION
* Ubuntu-22.04 Running 2
6. Access Windows Host from WSL (Linux)
WSL automatically mounts Windows disks under <span>/mnt/</span>:
ls /mnt/c # View C drive
cd /mnt/d/Users # Enter D drive's Users directory
Access localhost services (e.g., web servers) on the Windows host
Windows automatically forwards localhost requests from WSL 2 to the Windows host.
You can execute:
cat /etc/resolv.conf | grep nameserver | awk '{print $2}'
Output:<span>172.20.80.1</span>
The output IP (usually 172.x.x.1) is the gateway address for the Windows host in the WSL 2 network, which can be used to access services on Windows
7. Access WSL (Linux) from Windows Host
Windows still supports accessing services listening on 0.0.0.0 or 127.0.0.1 in WSL 2 (Microsoft has done port forwarding)
View the actual IP of WSL 2 (generally not needed):
hostname -I
Output:<span>172.20.90.116</span>
8. SSH Service is Not Enabled by Default in WSL
To log in via SSH from external sources (including Windows), you need to install and configure SSH in WSL:
# Download the latest package list information
sudo apt update
# Install SSH service
sudo apt install openssh-server
# Start SSH service
sudo service ssh start
# Check SSH service status
sudo service ssh status
9. Manually Update WSL Kernel (Requires Internet)
wsl.exe --update
10. Backup Environment
wsl --export Ubuntu-22.04 d:\Ubuntu-22.04_backup.tar
11. (Reinstall System) Import
wsl --import Ubuntu-22.04 d:\Ubuntu-22.04_backup.tar --version 2
12. Shut Down All WSL (Free Memory, Resolve Port Conflicts, etc.)
wsl --shutdown
13. Uninstall Linux from WSL
wsl --list --verbose
# or shorthand
wsl -l -v
Output:
C:\Users\TANGXG>wsl -l -v
NAME STATE VERSION
* Ubuntu-22.04 Running 2
Uninstall:
wsl --unregister Ubuntu-22.04