Saturday, June 22, 2019

How to install WSL 2?

In the previous post we learnt a bit about WSL 2. Now follow the below given steps to install WSL 2.
Ensure that you have WSL installed and that you are running Windows 10 build 18917 or higher. 


        Enable the 'Virtual Machine Platform' optional component and make sure WSL is enabled
    • Make sure that you have both the Windows Subsystem for Linux and the Virtual Machine Platform optional components installed. You can do that by running the following command in PowerShell:
    •  dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
      dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
     Restart your machine to finish installing both components

    Set a distro to be backed by WSL 2 using the command line: 

     To set a distro please run:

    wsl --set-version <Distro> 2

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

    Additionally, if you want to make WSL 2 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 WSL 2 distro.

    (If you do not have a Linux distro installed, please refer to the Install on Windows 10 docs page for instructions on installing one.)

    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
    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 WSL 2 distro!

     Please note WSL 2 is only available in Windows 10 builds 18917 or higher.
  • (source: Microsoft Docs
Update: watch this video  to see how to install WSL 2.

No comments: