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

A screenshot of a computer program

AI-generated content may be incorrect.

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

A screenshot of a computer

AI-generated content may be incorrect.

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

wsl --set-default-version 2
A blue screen with white text

AI-generated content may be incorrect.

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

wsl --list --online
A screenshot of a computer screen

AI-generated content may be incorrect.

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
A blue screen with white text

AI-generated content may be incorrect.

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.

A screen shot of a computer

AI-generated content may be incorrect.

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

A black screen with white text

AI-generated content may be incorrect.

Click the download URL, then run the installer

A screenshot of a video game

AI-generated content may be incorrect.

Down below is the installer successfully finishing the install.

A screenshot of a computer

AI-generated content may be incorrect.

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.

A computer screen shot of a black screen

AI-generated content may be incorrect.

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.

A screenshot of a computer

AI-generated content may be incorrect.

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

wsl
A screenshot of a computer program

AI-generated content may be incorrect.

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
A screen shot of a computer screen

AI-generated content may be incorrect.