Installing Linux on windows using wsl2

2022-12-07 09:36:11 mele 589

WSL (Windows subsystem for Linux): a subsystem of the windows system on which the Linux operating system can be installed and run. (for example, Ubuntu, openSUSE, Kali, Debian, etc.) 

It allows developers to run the GNU / Linux environment (including most command-line tools, utilities and Applications) directly on windows as is, without incurring the overhead of traditional virtual machines or dual boot settings. 

Compared with traditional virtual machines, wsl2 provides more comprehensive compatibility, better interoperability with Windows systems, faster running speed and less system resources. 

Prerequisites

You must be running Windows 10 version 2004 and higher (build 19041 and higher) or windows 11. 

Activate WSL service

Press Win + X to start Windows terminal (admin)

In the Windows terminal window, enter the following command to activate the WSL service:

Enter the following command to start the Linux subsystem:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Enter the following command to start the virtual machine platform:

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

Restart minipc after the operation completed successfully 

Set the version of WSL to WSL2

After restarting, reopen the Windows terminal(Admin) window and enter the following command in the window

wsl --set-default-version 2

Installing Linux operating system 

In the Windows terminal(Admin) window, enter:

wsl --list --online

List all installable Linux versions (such as Ubuntu, openSUSE, Kali, Debian, etc.)

  

Enter the following command to install ubuntu-20.04 LTS

wsl --install -d Ubuntu-20.04

Enter the following command to install Debian

wsl --install -d Debian 

 

After installation, start Ubuntu

  

If an error occurs during startup: 0x800701bc 

You need to download and install the latest wsl2 Linux kernel update package for x64 computers 

Download link: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi 

After downloading, double-click install

 

Restart Ubuntu and prompt to set user name and password

 

 

After the setup, the ubuntu-20.04 system is installed!