WSL 2 runs a Linux kernel inside a lightweight virtual machine that uses Microsoft’s Hyper-V technology. Hyper-V is just a type 1 bare metal hypervisor built into windows. You don’t manage the VM like you would do with Hyper-V manager, so it doesn’t have a lot of customization but that makes it very light and easier to run. It integrates with windows really well, for example I can access the Linux files in windows file explorer. It is really good if you just want to use some Linux tools or applications quickly.
Ensure Windows Subsystem for Linux and Virtual Machine Platform is check marked

Your computer may reboot. Ensure CPU Virtualization is turned on in your BIOS. This won’t work unless your CPU Virtualization is enabled in BIOS.
Alternatively, you can run these in PowerShell if you don’t want to use the Windows UI:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Go to PowerShell and run it as an administrator

Once in PowerShell we can set the default version of WSL to 2.0
wsl --set-default-version 2

Now we can start installing our lightweight virtual machine. We need to first list the options we currently have.
wsl --list --online

We will now install one of these valid distributions. I will be installing Ubuntu-24.04 for this example.
wsl --install -d Ubuntu-24.04

When it finishes installing an Ubuntu console will open and you may receive this error. We are receiving this error because we do not have the most recent version of the WSL 2 Linux kernel so we will install it right now.

Grab the URL from the error prompt and go to it.

Click the download URL, then run the installer

Down below is the installer successfully finishing the install.

Alternatively, we can just run the command below in PowerShell if you do not want to use the UI
wsl --update
Rerun the command we entered earlier
wsl --install -d Ubuntu-24.04
You should see this prompt now on the Ubuntu console that opens back up. This means that it was successful and you can now begin to make your user

Follow the prompt and finish setting up the user with the username and password. After that you are done and should be in the Ubuntu environment now.

If you exit the console, it will exit you out of the virtual machine. To connect back there are two ways to do it. One is through PowerShell and the other is to directly open the Ubuntu console. You can search it up in the windows search bar to directly open.

Another way is to simply open back up PowerShell and type wsl
wsl

To remove this virtual machine you can run this command in PowerShell to list what machines you have running currently
wsl --list --verbose
wsl --unregister Ubuntu-24.04
