How to install Ubuntu 21.10 on WSL for Windows 10 and 11
Installing WSL 2 on Windows 10 and 11 is easier than ever, and adding a distro to information technology requires footling more than than downloading an app from the Microsoft Store. But it doesn't have to end there. The Microsoft Store has a good, but limited option of Linux distros, and in the instance of Ubuntu, you're basically looking at the LTS versions and not the latest rolling releases.
For many, this is admittedly fine, just there will e'er be good reasons to want access to the latest version, especially in development. If y'all need Ubuntu 21.10, in that location'south no demand to get off and fire up a virtual motorcar; yous can quite easily install it on Windows 10 or xi.
You just have to know where to look.
How to download Ubuntu 21.x for WSL
Downloading Ubuntu 21.10 for WSL isn't hard, simply it'south also not peculiarly obvious where you fifty-fifty get information technology. Information technology is possible to upgrade inside WSL to the latest release, just in the example of 21.ten, you lot'd need to already be on 21.04.
But hither we're going to download an paradigm file and install a completely fresh build of Ubuntu 21.10.
To go the files you need, head over to the Ubuntu website and follow these steps.
- Click on the option labeled impish.
-
Next, click on current.
-
Locate the files labeled wsl.rootfs.tar.gz.
There volition be multiple files, but the ones labeled with manifest you can ignore. Y'all also need to choose the right version for your PC. If you lot're using an Intel- or AMD-powered machine, choose the amd64 version. If y'all're using an ARM-based car, cull the arm64 version.
Download the relevant file, then it's onto the installation process.
How to install Ubuntu 21.10 on WSL for Windows ten and 11
From here on out yous're going to exist in your PowerShell terminal. Have a notation of where you've downloaded the tar file from the steps above to as yous'll need the file location every bit part of the install process.
The process of installation begins with importing the downloaded paradigm from Ubuntu into your WSL setup. We have a full guide on exporting and importing Linux distros in WSL that can help, only we'll withal comprehend everything you lot need here.
Within PowerShell, you will need to enter the following command to import and install Ubuntu 21.x:
wsl --import <proper noun> <location to unpack> <location of download>
So, on my arrangement, information technology looks like this:
wsl --import Ubuntu-2110 c:/WSL/Ubuntu-2110 c:/Downloads/impish-server-cloudimg-amd64-wsl.rootfs.tar.gz
It doesn't really matter where you unpack and install the image, but information technology doesn't hurt to create a dedicated directory, especially if you plan on installing multiple distros in this fashion.
Additionally, you can specify a version of WSL at the terminate with the --version
flag. It volition install to whichever version of WSL your organization recognizes as default, but you can alter that at installation to save the demand to convert it later on on. Simply add together a 1 or a two after the flag to specify which version you require.
It'll have a minute, but once it'southward finished you can motion on to setting upwardly. As this hasn't been installed from the Microsoft Shop, there is no app shortcut created in the Beginning Menu. You'll need to launch it manually with:
wsl -d <distroname>
If you employ Windows Last, even so, and y'all really should, WSL will automatically add it to the dropdown menu with all the other shells you can open.
Basic setup of Ubuntu 21.ten
As you've basically sideloaded Ubuntu 21.10, it doesn't run through the initial setup procedure you get when y'all install Ubuntu from the Microsoft Store. As such you won't have a user ready up, at that place will simply be root. So y'all'll want to create ane and add it to the sudo group:
adduser <yourusername> usermod -aG sudo <yourusername>
And switch to that user with:
su <yourusername>
To launch into Ubuntu 21.10 every bit your new user, from PowerShell enter:
wsl -d <distroname> -u <yourusername>
While not a long procedure to switch to or enter your new installation as your user instead of root, automating the process is always better. Configuring the default user for a distro installed in this way is a little unlike to those that have an executable downloaded from the Store.
In that location are a few unlike ways you can handle this, only the easiest, and largely safest, is to edit the wsl.conf file on the distro to tell WSL to log you lot in as your user account instead of root. Open upwards Ubuntu 21.x and navigate to the file every bit below. The file likely doesn't be at first installation, and so let's become information technology ready, and for this you lot'll want to stay logged in as root and not your user account.
- In the terminal enter
cd /etc/
- Enter
ls
to list the contents. If yous don't have wsl.conf we can create one. - Enter
affect wsl.conf
. - Open the wsl.conf file with nano past entering
nano wsl.conf
.
Now you'll demand to enter the information needed to tell Ubuntu 21.ten to launch every bit user and not root. Enter the following block into the document.
# Set the user when launching a distribution with WSL. [user] default=YourUserName
The get-go line isn't required, but information technology'southward a good idea to continue comments throughout your wsl.conf file to remind you lot in plain English what each part does.
Exit nano by pressing Ctrl + Ten followed by Y and Enter to save the file. Close downward WSL entirely, leave it a few seconds, then when you next boot back into Ubuntu 21.ten, you should be user and not root.
Alternatively, if you're using Windows Terminal, open up the Settings, discover your Ubuntu 21.10 install in the sidebar, and in the control line box ensure this command is stored:
wsl.exe -d <distroname> -u <yourusername>
This will have the same event once closed down and restarted.
That'south all in that location is to information technology. It'south a petty more of a process than installing from the Microsoft Store, but it's not also difficult, and it's a process you can echo for futurity rolling releases or only to have multiple versions of the same distro installed for unlike purposes.
Source: https://www.windowscentral.com/how-install-ubuntu-2110-wsl-windows-10-and-11
Posted by: merrywasee1983.blogspot.com
0 Response to "How to install Ubuntu 21.10 on WSL for Windows 10 and 11"
Post a Comment