Skip to content

WSL

Windows-Subsystem-Linux

Active Requirement Services

UI mode

  • win + r
  • optionalfeatures
  • check Windows Subsystem for Linux
  • check Virtual Machine Platform

CLI mode

Check the requirement service first

"Microsoft-Windows-Subsystem-Linux", "VirtualMachinePlatform" | ForEach-Object { Get-WindowsOptionalFeature -Online -FeatureName $_ | Select-Object FeatureName, State }

Enable them

Enable-WindowsOptionalFeature -Online -FeatureName @("Microsoft-Windows-Subsystem-Linux", "VirtualMachinePlatform") -All -NoRestart

Pre-Configuration (if need)

Windows Hyper-V must be enabled except this one

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

off hypervisiorlaunchtype

bcdedit /set hypervisorlaunchtype off

Download

Install Manually

Here's how to manually install the Ubuntu WSL distribution you've downloaded:

  1. Unblock the File (if downloaded from web):

    Unblock-File -Path .\Ubuntu_2404.xx.x.appx
    
  2. Install via PowerShell:

    Add-AppxPackage .\Ubuntu_2404.xx.x.appx
    
  3. Launch Ubuntu:

    • From Start Menu: Search for "Ubuntu 24.04"
    • Or via PowerShell:

      ubuntu2404.exe
      

Post-Installation Setup

  1. Initialize User Account:

    ubuntu2404.exe config --default-user yourusername
    
  2. Switch to WSL2 (if needed):

    wsl --set-version Ubuntu-24.04 2
    
  3. Update Packages:

    sudo apt update && sudo apt full-upgrade -y
    
C:\Users\YourName\
├── WSL/
   ├── Ubuntu-24.04/   WSL virtual disk here
   └── Downloads/      Store .appx/.tar.gz files here

Install and Update from CLI

Get the list of available linux distributions

wsl --list --online

Install your favorite distro

wsl --install --distribution <name-of-dist>

Update new version of WSL

wsl --update

Delete the Installed Dist

wsl --unregister <dist-name>

Set Default Distro

wsl --set-default <dist-name>

Restart Network

net stop wslservice
net start wslservice

Important Note

Unfortunately when you set your region to Iran WSL can't to connect to microsoft store server and download the distro that you selected, as well as it doesn't give you an appropriate error message.