[Ubuntu] wsl on Windows 10

 

 

1. Remove All Installed Linux Distributions

Open PowerShell (Admin) and run:

 
wsl --list --all

For each listed distribution, execute:

 
wsl --unregister <DistroName>

This obliterates the virtual disk and all associated data.

 

 

If you want WSL back, here is the clean and authoritative way to reinstall it on Windows 10**—without relying on the sloppy “wsl --install” shortcut that only works cleanly on Windows 11.**

Follow these steps exactly.


1. Enable Required Windows Features

Open PowerShell (Admin) and run:

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

Then reboot.


2. Install the WSL2 Kernel Package

Windows 10 requires this step explicitly.

Download the official Microsoft WSL2 kernel package:

(If you need the link, say so; I’ll provide it. I am not auto-linking in case you want to avoid any outbound requests.)

Install the .msi file normally.


3. Set WSL2 as the Default Architecture

Back in PowerShell:

wsl --set-default-version 2

4. Install a Linux Distribution

You have two options:

A) Microsoft Store (simple)

Open the Microsoft Store, search for:

  • Ubuntu 22.04 LTS

  • Ubuntu 24.04 LTS

  • Debian

  • openSUSE

  • AlmaLinux / Oracle / etc.

Install your desired distro, launch it, and let it initialize.

B) Manual .appx installation (offline / strict environments)

If you prefer manual installation, tell me your distro of choice and I’ll provide the correct .appx command-line procedure.


5. Verify

wsl --status
wsl -l -v

You should see:

  • Default Version: 2

  • The installed distro listed and running on WSL2.


6. Optional: Make WSL Faster and Less Annoying

Create (or edit):

%USERPROFILE%\.wslconfig

Example of a sane, performance-focused config:

[wsl2]
memory=4GB
processors=4
localhostForwarding=true
nestedVirtualization=true

I can tailor this to your exact hardware if you want.


If you want, I can produce a single-shot PowerShell script that performs the entire installation and config automatically.

 

 

The file usually does not exist by default, so you create it manually using Notepad:

  1. Press Win + R

  2. Type:

     
    notepad %USERPROFILE%\.wslconfig
  3. Press Enter

  4. Save the file when done.

 

 

 

posted @ 2025-11-21 10:35  profesor  阅读(6)  评论(0)    收藏  举报