WSL2 custom installation location: WSL2-Ubuntu20.04LTS summary
reference documents
Manual installation steps for older versions of WSL | Microsoft Docs
Step 1 - Check the requirements to run WSL 2
- For x64 systems: Version 1903 or later, with build 18362 or later.
- For ARM64 systems: Version 2004 or later, with build 19041 or later.
- Versions earlier than 18362 do not support WSL 2. Use the Windows Update Assistant to update your version of Windows.
- Determine your computer type:
Open Command Prompt or PowerShell and enter the following command:
systeminfo | find "系统类型:"
- Check the Windows version and build number:
Windows logo key + R, then type "winver", select OK
Step 2 - Enable Windows Subsystem for Linux
Open PowerShell as administrator (Start menu > PowerShell > right-click > Run as administrator), then enter the following command and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
After running the above command, restart your computer.
Step 3 - Enable Virtual Machine Features
Before installing WSL 2, the "Virtual Machine Platform" optional feature must be enabled. A computer requires virtualization capabilities to use this feature.
Open PowerShell as administrator and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After running the above commands, restart your computer to complete the WSL installation and update to WSL 2.
Step 4 - Download the Linux kernel update package
- Download the latest packages:
- WSL2 Linux kernel update package for x64 machines
Note: If you are using an ARM64 machine, please download the ARM64 package . - Run the update package downloaded in the previous step. (Double-click to run - you will be prompted for elevated privileges, select "Yes" to approve the installation.) The default is "Next" to install, and when the installation is complete, restart your computer.
Step 5 - Set WSL 2 as the default version
Open PowerShell and run the following command to set WSL 2 as the default version:
wsl --set-default-version 2
Step 6 - Install the Linux distribution of choice
- Click to open the Microsoft Store page for Ubuntu 20.04 LTS :
- If you directly click Get to install the page opened in the previous step, it will be installed on the system disk (C drive) by default, and the download speed is sometimes very slow.
Quickly download the installation package: Copy the URL link in the red box in the previous step, click to open:
Microsoft Store - Generation Project (v1.2.3) [by @rgadguard & mkuba50]
Paste the link and click √ , the search result is as follows:
Click the suffix is the .appxbundle file link to download. - Change the suffix of the downloaded .appxbundle file to .zip and decompress it. The decompressed file directory:
- According to the type of your computer, select the installation package in the red box, change the suffix name of the selected installation package from .appx to .zip and decompress it. The decompressed file directory:
- Move the decompressed folder to the custom installation location, and double-click the .exe file in the execution directory, wait for a while, and the installation is complete. And prompts to create a new Unix user and set a password.
- If you need to log out and uninstall the WSL distribution, execute the following command in PowerShell:
wsl --unregister Ubuntu-20.04
- Basic WSL commands
This concludes the installation.