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

The Microsoft Store doesn’t have the latest version of Ubuntu for WSL, but that doesn’t mean you can’t install it yourself.

Installing WSL 2 on Windows 10 and 11 is easier than ever, and adding a distro to it just requires downloading the app from the Microsoft Store.

The Microsoft Store has a good but limited selection of Linux distributions, and with Ubuntu you’re basically looking at LTS releases, not the latest rolling releases.

If you need the latest version of Ubuntu 21.10, there is no need to start a virtual machine, you can easily install it on Windows 10 or 11.

You just need to know where to look.

  1. How to download Ubuntu 21.10 for WSL

It’s not hard to download Ubuntu 21.10 for WSL, it is possible to upgrade to the latest version inside WSL, but in the case of 21.10, you need to be already on 21.04.

But here we will download an image file and install a fresh Ubuntu 21.10 version.

To get the files you need, visit the Ubuntu website and follow these steps:

  1. Click on the option labeled impish.
  2. Next, click Current.
  3. Locate the file labeled wsl.rootfs.tar.gz.

There will be multiple files, but the ones marked with manifest can be ignored. You need to choose the correct version for your PC, if you are using an Intel or AMD powered machine, choose the amd64 version. If you are using an ARM-based machine, choose the arm64 version.

Download the relevant files and proceed to the installation process.

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

From now on, you will enter the PowerShell terminal. Make a note of the location where you downloaded the tar file in the steps above, as you will need that file location during the installation process.

The installation process starts by importing the downloaded image from Ubuntu into the WSL setup.

In PowerShell, you need to enter the following commands to import and install Ubuntu 21.10:

wsl–import

So, on my system it looks like this:

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

It doesn’t matter where you unpack and mount the image, but it doesn’t hurt to create a dedicated directory, especially if you plan to install multiple distributions this way.

Additionally, you can specify the version of WSL with the –version flag at the end. It will install to whatever version of WSL your system recognizes as default, but you can change it at install time to save the need to convert it later. Just add a 1 or 2 after the flag to specify the version you need.

This takes a minute, and once that’s done, you can move on to the setup. Since this application has not been installed from the Microsoft Store, there is no application shortcut created in the Start menu. You need to start it manually:

wsl-d<distroname>

However, if you really should be using the Windows Terminal, WSL will automatically add it to the drop-down menu, along with every other shell you can open.

  1. Basic settings of Ubuntu 21.10

Since you’ve basically sideloaded Ubuntu 21.10, it won’t run through the initial setup process you get when you install Ubuntu from the Microsoft Store. You won’t be setting up a user, only root, so you need to create one and add it to the sudo group:

adduser<yourusername>

usermod-aG sudo<yourusername>

and switch to that user with:

su<yourusername>

To start Ubuntu 21.10 as a new user, from PowerShell enter:

wsl-d<distroname>-u<yourusername>

While it’s not a long process to switch or enter a new install as a user rather than root, it’s always better to automate the process. A distribution installed this way configures the default user slightly differently than the user who downloads the executable from the store.

There are a few different ways to handle this, but the easiest and safest way is to edit the wsl.conf file on your distribution to tell WSL to log in as your user account instead of root. Open Ubuntu 21.10 and navigate to the file below. This file probably didn’t exist on the first install, so to set it up, you’ll need to log in as root instead of your user account.

  1. Enter cd /etc/ in the terminal
  2. Type ls to list the contents. If you don’t have a wsl.conf, you can create one.
  3. Enter touch wsl.conf.
  4. Enter nano wsl.conf. Use nano to open the wsl.conf file.

Now you need to enter the information needed to tell Ubuntu 21.10 to start as user instead of root. Enter the following in the document:

#Set the user when launching a distribution with WSL.

[user]

default=YourUserName

The first line is not required, but it is best to leave comments throughout the wsl.conf file to remind you in plain English what each section does.

Press Ctrl+X to exit nano, then press Y and Enter to save the file. Close WSL completely, wait a few seconds, then when you next boot back into Ubuntu 21.10, you should be user and not root.

Alternatively, if you’re using the Windows Terminal, open Settings, find your Ubuntu 21.10 installation in the sidebar, and make sure to store this command in the command line box:

wsl.exe-d<distroname>-u<yourusername>

This will have the same effect once shut down and restarted.

Be the first to comment

Leave a Reply

Your email address will not be published.


*