How to install Ubuntu 21.10 on Windows 10 and Windows 11 WSL

The WSL subsystem currently supports multiple Linux distributions, but when an update is released requires developers or the community to adapt in time and then put it on the Microsoft Store. For example, Ubuntu and Ubuntu 20.04 LTS versions are currently available for download in the Microsoft Store, and new versions such as Ubuntu 21.10 are not on the shelves.

However, the daily update of Ubuntu will provide the WSL version of the mirror installation package. After the mirror installation package is available, we can use the WSL command-line tool to import and install it. The operation process of other Linux distributions is similar. As long as the developer or community provides the image installation package, it can be imported and installed. The whole process is still very easy.

How to install Ubuntu 21.10 on WSL

Visit the Ubuntu official website to find the mirror download location and download the mirror image file. The file we want to download is wsl.rootfs.tar.gz. The specific version depends on the system architecture. For example, for Intel and AMD processors, download the AMD64 version. Put the downloaded image package in a fixed location, such as the C:\wsl folder, and then we use PowerShell to import and install the image package.
Import and install the image package
wsl –import <name> <location to unpack> <location of download>
For example on my computer it is like this

wsl –import Ubuntu-2110 c:/WSL/Ubuntu-2110 c:/Downloads/impish-server-cloudimg-amd64-wsl.rootfs.tar.gz

After the installation is complete, there is no startup icon, we need to start it manually

wsl -d <distroname>

By default, the system installed is logged in as root. Based on security considerations, it is recommended that users should create a normal user.
adduser <yourusername>
usermod -aG sudo <yourusername>
su <yourusername>

To launch into Ubuntu 21.10 as your new user, from PowerShell enter:

wsl -d <distroname> -u <yourusername>

Via: windowscentral