Table of Contents

Prerequisites

  1. Open Control Panel > Programs > Turn Windows Features on or off
  2. Turn on:
    • Windows Subsystem for Linux
    • Virtual Machine Platform
    • (Hyper-V is not necessary)

Install WSL

  1. Open PowerShell as Administrator
  2. Run the following command to install WSL2:
# Install WSL2
wsl --install

# Update WSL
wsl --update

# Set default version to WSL2
wsl --set-default-version 2

# List available distributions
wsl -l -o

# Install Ubuntu 22.04
wsl --install -d Ubuntu-22.04

Other commands we often use:

# Help
wsl --help

# Set default distribution
wsl --set-default Ubuntu-22.04

# Show installed distributions
wsl -l -v

# Shutdown WSL
wsl --shutdown

Uninstall WSL distributions

  1. Shutdown WSL wsl --shutdown
  2. Confirm the distribution stopped wsl -l -v
  3. Settings > Apps > Installed apps > Ubuntu-22.04 > Uninstall

References