1. Home
  2. /Hands-on Labs
  3. /Windows WSL & Ubuntu Lab

Windows WSL & Ubuntu Lab

Enable Windows Subsystem for Linux (WSL), deploy Ubuntu 24.04 LTS, explore additional distributions, and learn how to launch each environment.

Lab Objectives

  • Confirm virtualization support and required Windows features for WSL 2.
  • Install the latest WSL components and provision Ubuntu 24.04 LTS.
  • Discover, install, and manage additional Linux distributions.
  • Launch Linux shells from Windows Terminal, Start menu, and command line.

Prerequisites

  • Windows 11 (version 22H2 or later) or Windows 10 (version 21H2 or later).
  • Administrator privileges to enable optional Windows features.
  • BIOS/UEFI virtualization support enabled (Intel VT-x or AMD-V).
  • Internet access to pull WSL components and Linux distributions.

Part 1: Prepare Windows for WSL 2

  1. Verify virtualization: Press Ctrl + Shift + Esc to open Task Manager and confirm the Virtualization field on the Performance tab reads Enabled.
  2. Enable optional features (PowerShell as Administrator):
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    Restart the device when prompted so the features complete installation.
  3. After reboot, open an elevated Windows Terminal or PowerShell session and run wsl --status to confirm the default version is set to WSL 2. If it reports version 1, run wsl --set-default-version 2.

Part 2: Install Ubuntu 24.04 LTS

  1. In an elevated terminal, run:
    wsl --install -d Ubuntu-24.04
    The command installs the latest WSL kernel, the WSL manager, and downloads the Ubuntu 24.04 image.
  2. When prompted, restart Windows. On first launch, a console window titled Ubuntu 24.04 LTS appears and prompts for a UNIX username and password—record them in your lab notes.
  3. Inside Ubuntu, update packages to confirm network access:
    sudo apt update && sudo apt upgrade

Part 3: Explore Additional Distributions

  1. List distributions available from Microsoft:
    wsl --list --online
    Capture three options that interest you (for example, Debian, openSUSE-Leap-15.5, Kali-Linux).
  2. Install one additional distribution, substituting the exact name returned in the previous step:
    wsl --install -d Debian
  3. Set your preferred default distribution (optional):
    wsl --set-default Debian
    wsl --list --verbose
    Note the STATE and VERSION columns for each installed image.

Part 4: Launch and Manage Linux Sessions

  1. Windows Terminal: Open Windows Terminal, select the Ubuntu 24.04 profile from the dropdown, and confirm the shell launches to your Linux home directory.
  2. Start menu shortcuts: Search for Ubuntu 24.04 or the distro you installed. Pin it to Start or the taskbar for quick access.
  3. Command line launch:
    wsl                  # Launch default distro
    wsl -d Ubuntu-24.04   # Launch Ubuntu 24.04 explicitly
    wsl -d Debian         # Launch Debian
  4. Shutdown and maintenance: Use wsl --shutdown to close all instances, wsl --terminate <DistroName> to stop one distro, and wsl --unregister <DistroName> to remove it (irreversible).

Quick Reference

wsl --status
wsl --set-default-version 2
wsl --install -d Ubuntu-24.04
wsl --list --online
wsl --set-default Debian
wsl --shutdown

Troubleshooting Tips

  • If wsl --install fails, run wsl --update and retry.
  • Hyper-V conflicts? Disable competing hypervisors (VirtualBox legacy drivers, VMware Workstation older than 16.1).
  • Networking issues inside Linux? Run wsl --shutdown and reopen the distro to refresh the virtual switch.
  • Missing distributions? Open Microsoft Store, search for the distro, and choose Get.