Skip to content

Instantly share code, notes, and snippets.

@yusiwen
Created March 29, 2020 17:05
Show Gist options
  • Save yusiwen/249ddeb4555c3c0b5b4d2b8dbb355ba9 to your computer and use it in GitHub Desktop.
Save yusiwen/249ddeb4555c3c0b5b4d2b8dbb355ba9 to your computer and use it in GitHub Desktop.
[WIndows 10 Install WSL2] #wsl #windows

Install WSL2

Ensure that you have WSL installed (you can find instructions to do so here) and that you are running Windows 10 build 18917 or higher

To make sure you are using build 18917 or higher please join the Windows Insider Program and select the 'Fast' ring or the 'Slow' ring.

You can check your Windows version by opening Command Prompt and running the ver command.

Enable the 'Virtual Machine Platform' optional component and make sure WSL is enabled

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart windows

Set a distro to be backed by WSL2 using the command line

To set a distro please run:

wsl --set-version <Distro> 2

and make sure to replace <Distro> with the actual name of your distro. (You can find these with the command: wsl -l). You can change back to WSL1 at anytime by running the same command as above but replacing the '2' with a '1'.

Additionally, if you want to make WSL2 your default architecture you can do so with this command:

wsl --set-default-version 2

This will make any new distro that you install be initialized as a WSL2 distro.

Finish with verifying what versions of WSL your distro are using

To verify what versions of WSL each distro is using use the following command (only available in Windows Build 18917 or higher):

wsl --list --verbose
#or
wsl -l -v

The distro that you've chosen above should now display a '2' under the 'version' column. Now that you're finished feel free to start using your WSL2 distro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment