WSL 2 installation and how to convert WSL 1 to WSL 2

WSL 2 is a new version of the architecture in WSL, which changes the way Linux distributions interact with Windows. The main goal of WSL 2 is to improve file system performance and increase full system call compatibility. Each Linux distribution can run as a WSL 1 or WSL 2 distribution, and you can switch between them at any time. WSL 2 is a major transformation of the basic architecture, which uses virtualization technology and the Linux kernel to implement its new features.

To install and start using WSL 2, complete the following steps:

WSL 2 is only available for Windows 10 version 18917 or higher

  • Please make sure you have WSL installed (you can find instructions on doing this here ) and are running Windows 10 version 18917 or higher
    • To ensure that you are using version 18917 or later, join the Windows Preview Experience Program and select the "fast" ring or "slow" ring.
    • By opening a command prompt and run verto check the Windows version command.
  • Enable the "Virtual Machine Platform" optional component
  • Use the command line to set the distribution to be supported by WSL 2
  • Verify the WSL version used by the release

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

You need to ensure that both the "Windows Subsystem for Linux" and "Virtual Machine Platform" optional components are installed. You can do this 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

Requires Windows 10 build 18917 and above, enable 'Virtual Machine Platform' can be in the control panel or powershell
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Please restart the computer to complete the installation of the two components.

Use the command line to set the distribution to be supported by WSL 2

If you have not installed the Linux distribution, please refer to the installation documentation page on Windows 10 for instructions on installing.

To set up the release version, run:

wsl --set-version <Distro> 2

And to ensure that the <Distro>replaced with the actual name of your release. (You can use the following command to find these contents:) wsl -l. You can change back to WSL 1 at any time by running the same command as above, but replacing "2" with "1". .

In addition, if you want to make WSL 2 your default architecture, you can do this with this command:

wsl --set-default-version 2

This will initialize any new releases you install to the WSL 2 release. distro.

Complete verification of the WSL version used by the release

To verify the WSL version used by each release, use the following command (available only in Windows version 18917 or later):

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

The distribution selected above should now display "2" under the "version" column. Now that it is complete, you can start using the WSL 2 release at any time!

WSL 2 installation and how to convert WSL 1 to WSL 2

Guess you like

Origin www.linuxidc.com/Linux/2020-04/162879.htm