1.Install WSL with default Ubuntu:
wsl --install
and then reboot.
2.List Available Distributions for Installation:
wsl -l -o
output eg:
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
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_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
3. Install a certain distribution:
wsl --install -d Ubuntu-24.04
4. List Installed Linux Distributions and Their WSL Versions:
wsl -l -v
5. Set Default Version for New Linux Installations (WSL 1 or WSL 2):
wsl --set-default-version <Version#>
Replace with 1 or 2 to set the default WSL version for new Linux installations.
6. Set Default Linux Distribution:
wsl -s <DistributionName>
7. Run a Specific Linux Distribution:
wsl -d <DistributionName>
8. Upgrade or Downgrade a Specific Linux Distribution between WSL 1 and WSL 2:
wsl --set-version <distro name> <Version#>
9. Launch the Default Linux Distribution from Command Prompt or PowerShell:
wsl
10. Run Linux Commands without Switching Distributions:
wsl [command]
11. remove an installed Linux distribution in WSL:
wsl --unregister <DistributionName>
12. Default Storage Location:
C:\Users\<YourUsername>\AppData\Local\Packages\CanonicalGroupLimited...Ubuntu..._\LocalState\ext4.vhdx
13. Export an Existing Distribution:
wsl --export <DistributionName> <ExportFilePath>
# eg: wsl --export Ubuntu C:\backups\ubuntu.tar
14. Import to a Custom Location:
wsl --import <NewDistributionName> <TargetFolder> <ImportFilePath>
# eg: wsl --import UbuntuCustom C:\wsl\UbuntuCustom C:\backups\ubuntu.tar
WSL を使用して Windows に Linux をインストールする方法
15. sets up a port proxy from any network interface on a certain port to the local machine’s port. eg:
netsh interface portproxy add v4tov4 listenport=2358 listenaddress=0.0.0.0 connectport=2358 connectaddress=127.0.0.1
just edit /etc/wsl.conf:
[boot]
systemd=true
[user]
default=fsi
[interop]
enabled=true
appendWindowsPath=true
- Enables systemd
- Sets default user fsi
- Lets WSL run Windows apps
- Adds Windows paths to
$PATH
Restart WSL to apply