How to install Ubuntu on WSL2 on Windows 10/11

How to install Ubuntu on WSL2 on Windows 10/11

Written by Adam. R on Feb 22nd, 2022 Views Report Post

Wow! It's been 3 MONTHS since I made my last post on AWS... Well, I deciced to come back! I have already planned some more upcoming posts and more! Let's get into it!


Intro

Some developers are Windows user which makes it difficult to use bash. Unlike MacOS users who can easially get bash fully working. You may have heard that Microsoft the creator of Windows have teamed-up with linux operating systems team to allow Windows Users to have certain Linux OS's installed. Some OS's like Ubuntu, Debian, Kali are available to install. But how do you install them? Well I will tell you how!


What is WSL?

Windows Subsystem for Linux (WSL) allows you to install a complete Ubuntu terminal environment in minutes on your Windows machine, allowing you to develop cross-platform applications without leaving Windows.

In this tutorial, we’ll show you how to get up and running with Ubuntu on WSL. These instructions will work on both Windows 10 or Windows 11.


Installation

Installing WSL is now easier than ever. Search for Windows PowerShell in your Windows search bar, then select Run as administrator.

powershell admin.png

At the command prompt type:

wsl –install

And wait for the process to complete.

For WSL to be properly activated, you will now need to restart your computer.


Download the Linux OS

As you know, WSL supports a variety of Linux distributions, including the latest Ubuntu release, Ubuntu 20.04 LTS and Ubuntu 18.04 LTS. You can find them by opening the Microsoft store app and searching for Ubuntu or any other Linux OS you need. ubuntu.png I already installed Ubuntu on my desktop.

Other methods of installing

There is a single command that will install both WSL and Ubuntu at the same time. When opening PowerShell for the first time, simply modify the initial instruction to:

wsl --install -d ubuntu

This will install both WSL and Ubuntu! Don’t forget to restart your machine before continuing.

Once installed, you can either launch the application directly from the store or search for Ubuntu in your Windows search bar. ubuntu open.png


Configure Ubuntu or Other Linux OS

Congratulations, you now have an Ubuntu terminal running on your Windows machine!

If Ubuntu returns an error during this initial installation, then the most common issue is that virtualisation is disabled in your device’s BIOS menu. You will need to turn this on during your device’s boot sequence. The location of this option varies by manufacturer, so you will need to refer to their documentation to find it.

Once Ubuntu has finished its initial setup you will need to create a username and password (this does not need to match your Windows user credentials). ubuntu crediantals.png Finally, it’s always good practice to install the latest updates with the following commands, entering your password when prompted.

sudo apt update

Then

sudo apt upgrade

Press Y when prompted.


Conclusion

Who needs AWS or Google Cloud for Windows users to access Linux Terminals just for testing? WSL (Windows Subsystem Linux) makes it much easier! You have the full access of linux infront of you!

If you found this usful then please share this and follow me!

Comments (0)