Install Ubuntu (WSL2) on Windows 10

Install Ubuntu(WSL2) on Windows 10: Because Ubuntu(WSL1) does not have debugging capabilities, install Ubuntu(WSL2) as much as possible.

The specific process is as follows:

1. What is WSL?

Windows Subsystem for Linux (WSL for short), the Linux subsystem under Windows, is a compatibility layer that can run native Linux binary executable files (ELF format) on Windows 10. It was developed by Microsoft in cooperation with Canonical. Its goal is to enable pure Ubuntu, Debian and other images to be downloaded and decompressed to the user's local computer, and the tools and utilities in the image can run natively on this subsystem.

2. Comparison of dual-system methods

3. Comparison between WSL1 and WSL2

Function

WSL1

WSL2

Integration between Windows and Linux

Short startup time

Uses less resources than traditional virtual machines

Works with current versions of VMware and VirtualBox

Hosted VM

×

Complete Linux kernel

×

Full system call compatibility

×

Cross-OS file system performance

×

Debugging function

×

4. WSL2 installation steps

4.1 Check and update windows system version

Requirements: Win10 update system to version 1903 or higher

If the version is lower than 1903, you can use the Windows 10 Easy Upgrade tool to manually upgrade. Download the Windows 10 upgrade tool:

下载 Windows 10
https://www.microsoft.com/zh-cn/software-download/windows10

View method:

Method 1: Press Win+R on the keyboard to bring up the run window, then enter the "winver" command and press Enter.

4.2 Turn on Windows features

4.2.1 Find Turn Windows features on or off

4.2.2 Check Windows Subsystem (Beta) and Virtual Machine Platform for Linux

4.2.3 Open Settings-Update & Security-Developer Options

Open the Developer Options button

4.3 Enabling the Windows subsystem for Linux

If you have not used WSL before, you first need to enable the Windows Subsystem for Linux:

Enter powershell in the search box, open powershell as an administrator and run it. If you open it directly and enter the command, a permission error will be reported.

After opening Windows PowerShell, execute the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

The execution results are as follows:

4.4 Restart the computer

To make sure all relevant parts are neatly in place, you need to reboot your system, otherwise you may find that things don't work as expected. Restart your computer to complete the WSL installation and update to WSL2.

4.5 Download the Linux kernel update package

Download the kernel update package and install: WSL2 Linux Kernel Update Package for x64 Machines

Once the download is complete, double-click the installation to complete!

4.6 Open the Microsoft Store

Find Ubuntu and click to download and install it. Which version to install depends on your needs.

4.7 After the installation is complete, open Ubuntu to set the user name, set the password, and confirm the password

4.8 Installation completion effect

4.9 Open cmd or Windows PowerShell and enter the following command to view the WSL installation version

wsl -l -v

View the results as follows:

Note: You can directly open Ubuntu when using it later, or open cmd or Windows PowerShell and enter: bash command to enter linux

Guess you like

Origin blog.csdn.net/weixin_47156401/article/details/134359205