Windows 10 wsl1 to wsl2

Time:2020-10-22

Special advantages of wsl2 (second generation of win10 subsystem)

  • Completely reconstruct the WLS generation, 20% faster than the previous generation
  • Support native docker installation and startup (equivalent to complete Linux system and virtual machine running)
  • Support all kinds of one key script, such as pagoda one key script, hundred read one key script and so on
  • Win10 file manager can access Linux system files
  • The plug-in vs remote with vs code can rapidly develop the development environment based on Linux system with ultra-low latency

For docker, it takes about a minute to start docker for win10 desktop version. On wls2, starting docker is really completed in an instant.

Installation method of wls2 win10 subsystem (very fast, less than one minute)

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

  1. Enable virtual machine platform optional components
  2. Use the command line to set the distribution to be supported by WSL 2
  3. Verify the WSL version used by the distribution
  4. And you need to have WSL installed (instructions for doing this can be found here).

Note that you need to run Windows 10 version 18917 or later to use WSL

Enable virtual machine platform optional components

1. Open the PowerShell as an administrator and run it:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

2. You need to restart your computer for these changes to take effect

Update WSL 2 Linux kernel

Update wsl2 kernel
1. Download the Linux kernel update package
Download the latest wsl2 Linux kernel update package for x64 computers.
2. Run the downloaded installation package

Use the command line to convert the distribution of WSL 1 to wsl2

Running in PowerShell
1. View the existing WSL:

wsl -l -v

###Output results
PS C:\WINDOWS\system32> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1

2. Execution Transformation:

wsl --set-version Ubuntu-18.04  2

###Output results
Conversion in progress, this may take a few minutes
For information on the main differences from WSL 2, visit https://aka.ms/wsl2
Conversion complete.

3. If you want to make WSL 2 your default architecture, you can do this through this command:

wsl --set-default-version 2

##Output results
For information on the main differences from WSL 2, visit https://aka.ms/wsl2

4. Test after conversion:

wsl -l -v

##Output results
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         2

Starting the daemon thread of docker does not require docker desktop

Execute the following command in wsl2 to start the daemons thread:

sudo service docker start

Use the following command to test the run:

sudo docker run hello-world

Recommended Today

Comparison and analysis of Py = > redis and python operation redis syntax

preface R: For redis cli P: Redis for Python get ready pip install redis pool = redis.ConnectionPool(host=’39.107.86.223′, port=6379, db=1) redis = redis.Redis(connection_pool=pool) Redis. All commands I have omitted all the following commands. If there are conflicts with Python built-in functions, I will add redis Global command Dbsize (number of returned keys) R: dbsize P: print(redis.dbsize()) […]