Enable Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -All
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
wsl --version
wsl --install
wsl --set-default-version 2
wsl --install
copy the extracted folder to your any drive where you like to have WSL Linux and run .exe
wsl –list –verbose #to check all the installed distro wsl –unregister Ubuntu #to remove the distro
The ext4.vhdx file will be deleted, and you can again run Ubuntu.exe setup file to start over.
- ext4.vhdx filenames by referencing the registry, ex: powershell:
```powershell
(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}) | select DistributionName,BasePath,VhdFileName
wsl portproxy from windows os
netsh interface portproxy show all
ip a
sudo ufw allow 8000
New-NetFirewallRule -DisplayName "Allow Inbound Port 8000" -Direction Inbound -LocalPort 8000 -Protocol TCP -Action Allow
netsh interface portproxy add v4tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=<the_wsl_ip>
netsh interface portproxy show all
To move a WSL (Windows Subsystem for Linux) distribution to a new computer, you can export it as a .tar file and then import it on the new machine. This process involves using the wsl –export command to create the backup, transferring the file, and then using wsl –import to restore it.
wsl --shutdown or wsl --terminate <DistributionName>
wsl --export <DistributionName> <FileName>
wsl --unregister <DistributionName>
wsl --import <NewDistributionName> <InstallLocation> <BackupFilePath>
wsl --distribution <NewDistributionName>
WSL Version: These instructions generally apply to WSL2. If you have a WSL1 distribution, you’ll need to back up the %localappdata%\lxss directory instead of using wsl –export, says Ask Ubuntu.
File System: WSL uses a virtual hard disk (VHD) file for its file system. For WSL2, you can also use the –vhd flag with wsl –import to import the VHD directly, which can be faster.
Permissions: When restoring a WSL1 backup, you might need to manually reset file permissions.
Disk Space: The .tar backup file can be quite large, so ensure you have enough disk space on both the source and destination machines.
New Name: When importing, it’s recommended to use a new name for the distribution to avoid potential conflicts, according to a Reddit user.