Install WSL on Windows Server 2025 — Zero-Error Guide

  • Home
  • Blog
  • Install WSL on Windows Server 2025 — Zero-Error Guide
wsl windows server
DateSep 16, 2025

Install WSL on Windows Server 2025 — Zero-Error Guide


Quick path: the single-command install (the fast win)

If your server is running the Desktop Experience (not Server Core) and has internet access, the simplest way is:

# Run from elevated PowerShell (Run as Administrator)
wsl --install
Restart-Computer

That single command will enable required Windows optional components, download the WSL2 kernel, set WSL2 as the default, and install a Linux distro (Ubuntu by default). Use this when you want the fastest, lowest-effort setup.

Why this works: Microsoft packaged the whole pipeline; the command toggles features, grabs the kernel package, and pulls a distro, so admins don’t need to piece it together. ubuntu 20.04 download on windows server Good for clean environments with the Store/Internet reachable.



Robust/manual install — for Server Core, locked networks, and offline installs

If your server is Server Core, has no Microsoft Store, or is offline, follow the manual steps below.

1) Enable WSL features (PowerShell or DISM)

Use either PowerShell or DISM — the choice depends on your environment:

PowerShell (concise):

# From an elevated PowerShell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux, VirtualMachinePlatform -NoRestart
Restart-Computer


DISM (scriptable & works in automation):

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart-Computer

Why: WSL2 uses a lightweight virtual machine layer (VirtualMachinePlatform). Enabling both ensures WSL can host the Linux kernel and provide WSL2 features.

2) Install the WSL2 Linux kernel package

If wsl –install didn’t run the kernel for you, download and install the MSI manually:

Invoke-WebRequest -Uri "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi" -OutFile ".\wsl_update_x64.msi"
Start-Process msiexec.exe -ArgumentList "/i .\wsl_update_x64.msi /quiet" -NoNewWindow -Wait

Why: On Server SKUs, the automatic kernel update sometimes doesn’t run; running the MSI ensures the WSL2 kernel is present.

3) Download Ubuntu 20.04 (or other distro) manually

If Store isn’t available, use the Microsoft shortlinks and install the appx:

# Example: download Ubuntu 20.04 appx
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
# Then install:
Add-AppxPackage .\Ubuntu.appx     # Note: Add-AppxPackage won't work on Server Core

If you are on Server Core (or Add-AppxPackage fails), extract the appx (it’s a zip) and follow the Server install steps — extract specific DistroLauncher files, place them in %LocalAppData%, and add to PATH so you can launch ubuntu.exe. The manual install docs show the exact extraction and AppData steps.

Why: Servers often lack access to the Microsoft Store and require offline/manual installation channels. The aka.ms links are the officially supported manual download route for WSL distributions.



How to reinstall WSL safely (backup → unregister → reinstall)

If you must reinstall WSL or a distro without losing everything, do this:

  1. Export (backup) your distro:
wsl --export Ubuntu C:\backups\ubuntu-2025-backup.tar
  1. Unregister the distro (this deletes distro data):
wsl --unregister Ubuntu
  1. Reinstall:
  • Option A: wsl –install -d Ubuntu (fast path)
  • Option B (manual): wsl –import Ubuntu C:\WSL\Ubuntu C:\backups\ubuntu-2025-backup.tar –version 2

Why: wsl –unregister removes the distro from WSL (data gone). Exporting lets you recreate or restore. how to reinstall wsl These are official WSL commands and the recommended flow for reinstalling.



Top troubleshooting scenarios (and fixes)

Below are the real errors admins hit — and the exact fixes.

Problem: wsl –install prints help text or “no installed distributions”

  • Cause: The system can’t reach the DistributionInfo.json service or the Store list, or WSL is partially installed.
  • Fixes:
    • Run wsl –list –online to confirm available distros.
    • If networking blocks it, use the manual appx/.wsl file route (see manual install).


Problem: WSL2 refuses to run — kernel missing or errors while setting the version

  • Fix: Manually install the kernel MSI (see step 2), then wsl –set-default-version 2 and restart WSL: wsl –shutdown.

Problem: WSL2 on Windows Server 2022 (or older) requires updates

Problem: Running WSL inside a VM (VMware/VirtualBox) — kernel/virtualization fails

  • Fix: Enable nested virtualization on the VM host (Hyper-V, VMware) and ensure VT-x/AMD-V is enabled. On VMware, enable vhv.enable = “TRUE” in the VM config. Also, ensure VirtualMachinePlatform is enabled on the guest and the kernel MSI is installed.

Problem: Add-AppxPackage fails on Server Core

  • Fix: Rename the .appx to .zip, expand the appropriate Launcher Appx for your architecture, and place extracted files under %LocalAppData%\… as the manual server doc details. Then add the new folder to PATH.




Post-install tuning & best practices

  • Set WSL2 as default: wsl –set-default-version 2 (new distro installs will use WSL2).

  • Create a .wslconfig in %UserProfile% to limit memory/CPU or set localhost forwarding, e.g.:
[wsl2]
memory=4GB
processors=2
localhostForwarding=true

This avoids runaway vmmem resource usage in server environments.

  • Use wsl –export regularly for backups, and keep the backup tar on another volume.

  • Security: Don’t expose SSH on WSL without firewall rules; remember, WSL runs inside your Windows server security boundary.

  • Automation: Script DISM/Enable-WindowsOptionalFeature + MSI install in your image-build pipeline for reproducible server images.




Quick copy-paste checklist (1 minute)

  1. Open elevated PowerShell.
  2. Try fast install (Desktop Experience only):
wsl --install
Restart-Computer
  1. If manual required:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart-Computer
Invoke-WebRequest -Uri "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi" -OutFile ".\wsl_update_x64.msi"
Start-Process msiexec.exe -ArgumentList "/i .\wsl_update_x64.msi /quiet" -NoNewWindow -Wait
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
# Then follow manual unpack/installation if Add-AppxPackage fails (Server Core)

Leave a Reply