⚙️ Getting a Linux Environment

Getting a Linux Environment: WSL2 (Windows Subsystem for Linux 2) is not a simulator or an emulator — it runs a genuine Linux kernel inside a lightweight VM right alongside Windo

WSL2 (Windows Subsystem for Linux 2) is not a simulator or an emulator — it runs a genuine Linux kernel inside a lightweight VM right alongside Windows, the same way Docker Desktop does it under the hood. Think of it like a flight simulator that uses a real aircraft engine: the controls look like a game, but the physics are authentic. But consider this: if you already have Docker on Windows, why bother with WSL2 at all? Because when a `chmod +x` command behaves differently, a bash script line-ending breaks inside a container, or a `grep` pattern works on your machine but not in CI, you need to reproduce that exact Linux environment locally and step through it — Docker is for shipping, WSL2 is for debugging. In Java terms, WSL2 is to Linux what the JVM is to bytecode: it provides the real execution environment on your local hardware, not just a thin wrapper. In QA practice, this closes the most expensive class of bugs — the ones that are invisible on your laptop but block the entire nightly regression run at 3 AM on a GitHub Actions ubuntu-latest runner.

Windows → WSL2 (Windows Subsystem for Linux)

Run in PowerShell as Administrator. This installs WSL 2 and a default Ubuntu distribution. Restart your computer afterwards.

Lists installed Linux distributions and confirms they are running version 2 (not the older, slower WSL 1).

Launches Ubuntu. On first run it asks you to create a Linux username and password — separate from your Windows account.

Updates the package list and upgrades installed packages. Run this right after first setup.

Verifies the installation. Expected output includes "Distributor ID: Ubuntu" and a version number like "22.04".

🎬 WSL2: The Real Linux Inside Windows

Real Linux kernel (VM)

lsb_release verification

Unreproducible CI failure

The problem: your tests blow up at 3 AM on `ubuntu-latest`, but your machine is Windows — you have NO local Linux ground to reproduce the failure on.

One command: `wsl --install` — run in PowerShell (Administrator), it installs WSL2 AND the default Ubuntu distribution together. A restart is required.

The critical point: this is NOT an emulator or a simulator. WSL2 runs a REAL Linux kernel inside a lightweight VM — the very same mechanism Docker Desktop uses on Windows.