Home  >  Article  >  Steps to set up and install WSL 2 on Windows 10 and 11

Steps to set up and install WSL 2 on Windows 10 and 11

PHPz
PHPzforward
2023-04-21 17:37:091099browse

If you haven't heard, Microsoft loves Linux. This statement raises the eyebrows of skeptics, but then you look at Windows Subsystem for Linux (WSL) and start to see the truth. WSL 2 allows you to install a Linux environment running the full Linux kernel in Windows 11 or 10 (if you're still using it), and the integration between the two is fairly tight. The first version of WSL had no kernel and poor performance. WSL is still essentially a virtual machine, but it has deep ties to its Windows host.

For developers, WSL means seamless access to Windows and Linux without using traditional virtual machines. However, you don't have to be a developer, it's a solid tool that anyone can use, whether they're a veteran or just starting out with Linux.

Microsoft has also done a lot of work on the onboarding experience, and now WSL 2 is easier than ever to get up and running. Here's how it's done.

What you need to run WSL 2 on Windows 10 and 11

如何在 Windows 10 和 11 上设置和安装 WSL 2

You don’t need a super powerful PC to run WSL 2, nor do you need to Use a "professional" version of Windows like the Hyper-V VM tool. WSL 2 does take advantage of the Hyper-V architecture, but you don't have to pay extra for it.

WSL 2 also supports x64 and ARM processors. However, if you are using it on an ARM-based machine, you will need to use a Linux version with an ARM version, such as Ubuntu.

WSL 2 can also run on Windows inside a virtual machine, as long as the VM software you are using supports nested virtualization and has this feature enabled.

How to Install WSL 2

如何在 Windows 10 和 11 上设置和安装 WSL 2

The installation process for WSL 2 is now so simple that you can be up and running in minutes. The only prerequisite is that you are on Windows 10 version 2004 and above (and you really should be by now) and have the KB5004296 patch applied.

There are two options to choose from: use the Microsoft Store or use PowerShell.

First, just open the Microsoft Store and download the "Windows Subsystem for Linux Preview" app. This will hopefully be the place to get WSL in the long term, as it will allow teams to update it without having to go through Windows Update.

Alternatively, open PowerShell on your PC and enter the following command:

wsl –install

Sit back and wait for it to do its thing, Restart your computer when the signal is received and voila! WSL 2 is now set up on your PC. The default distro is Ubuntu, but you are free to use any other distro from the Microsoft Store or third-party sources like Github or directly from the distro manufacturer.

If you are using Windows 11, the Windows Terminal app is preinstalled and is the best way to use WSL on your PC. You can launch a distro via PowerShell using the command "wsl -d" followed by its name, but using Windows Terminal you can access each installed distro from a drop-down menu.

If you don't have Windows Terminal installed, you can get it from the Microsoft Store or through the Windows Package Manager.

The above is the detailed content of Steps to set up and install WSL 2 on Windows 10 and 11. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yundongfang.com. If there is any infringement, please contact admin@php.cn delete