wsl (Windows Subsystem for Linux) is the Linux subsystem for Windows. It is a technology that enables running native Linux on Windows 10/11.
wsl2 is an iterative version that can better run the Linux subsystem on Windows.
Here we use Windows 11 to install Ubuntu as an example.
Turn on Windows features
-
Key press
Win
, click设置
. -
Search
控制面板
. -
Click
程序
. -
Click to turn the feature on or off
Windows
. -
Scroll to the bottom and check
适用于Linux的Windows子系统
the and虚拟机平台
. -
Click
确定
.
Install wsl2
-
The administrator runs the command window and executes the update command:
wsl --update
-
Execute the installation command:
wsl --install
-
Now wsl2 is generally used, so you also need to set:
wsl --set-version 2
app store installation
-
Open the Microsoft store to install the Linux system you want to install. Select Ubuntu here.
-
After the installation is complete, click Open .
-
After opening, it will show that the installation is in progress. After a while, the following prompt for entering your account and password will appear.
Here you can set your own username and password to log in, or you can close the window directly. When you open it again next time, you will log in as root by default, with higher permissions.
Command installation
-
View the list of available distributions
wsl --list online
-
Install the distribution that needs to be installed
wsl --install -d ubuntu
After the installation is complete, click Run. After a while, you will be prompted to enter your user name.
Here you can set your own username and password to log in, or you can close the window directly. When you open it again next time, you will log in as root by default, with higher permissions.
-
environment
Windows 10 Pro 22H2
Ubuntu 22.04.2