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
- Verify virtualization: Press Ctrl + Shift + Esc to open Task Manager and confirm the Virtualization field on the Performance tab reads Enabled.
- 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. - After reboot, open an elevated Windows Terminal or PowerShell session and run
wsl --statusto confirm the default version is set to WSL 2. If it reports version 1, runwsl --set-default-version 2.
Part 2: Install Ubuntu 24.04 LTS
- 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. - 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.
- Inside Ubuntu, update packages to confirm network access:
sudo apt update && sudo apt upgrade
Part 3: Explore Additional Distributions
- List distributions available from Microsoft:
wsl --list --online
Capture three options that interest you (for example, Debian, openSUSE-Leap-15.5, Kali-Linux). - Install one additional distribution, substituting the exact name returned in the previous step:
wsl --install -d Debian
- 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
- Windows Terminal: Open Windows Terminal, select the Ubuntu 24.04 profile from the dropdown, and confirm the shell launches to your Linux home directory.
- Start menu shortcuts: Search for Ubuntu 24.04 or the distro you installed. Pin it to Start or the taskbar for quick access.
- Command line launch:
wsl # Launch default distro wsl -d Ubuntu-24.04 # Launch Ubuntu 24.04 explicitly wsl -d Debian # Launch Debian
- Shutdown and maintenance: Use
wsl --shutdownto close all instances,wsl --terminate <DistroName>to stop one distro, andwsl --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 --installfails, runwsl --updateand retry. - Hyper-V conflicts? Disable competing hypervisors (VirtualBox legacy drivers, VMware Workstation older than 16.1).
- Networking issues inside Linux? Run
wsl --shutdownand reopen the distro to refresh the virtual switch. - Missing distributions? Open Microsoft Store, search for the distro, and choose Get.