×

Install Ubuntu on WSL2 on Windows 10/11 – LinuxWays

Install Ubuntu on WSL2 on Windows 10/11 – LinuxWays


The WSL or Windows Subsystem for Linux is an application offered by Microsoft that allows you to Run your Windows Operating System alongside your Ubuntu Operating System. Unlike Dual Boot and Virtual Machines, the WSL requires fewer resources than a Virtual Machine and saves you frustration and anger when switching between Operating Systems as you do not have to reboot your system again and again. With WSL, you can easily run Ubuntu Commands and Applications directly through your Windows Operating System.

This article discusses the Installation method of Ubuntu on WSL on Windows.

Install Ubuntu on WSL2 on Windows 10/11

Ubuntu can be installed alongside Windows using WSL. To install Ubuntu on WSL, you need to have WSL Installed and then an Ubuntu Application that will be installed through WSL. The steps below guide you about the Installation of Ubuntu on WSL on Windows.

Step 1: Install WSL

Install WSL through the Store. To open the Microsoft Store on your Windows 11 Operating System, click on the Search Box in your Taskbar:

In the Search Option, write Microsoft Store and the Microsoft Store Application will appear. Click on the Microsoft Store App to open it:

In the Microsoft Store, you will see the Search Bar on the top. Click on it to search for Applications in the Store:

In the Search Box, search for “Windows Subsystem for Linux”. The Windows Subsystem for Linux Applications will appear:

Once you open the WSL App, you will see the “Install” or “Get” Button. Click on the “install” button to start Downloading WSL:

Wait for the Application to Complete Downloading. Once the Application Downloads, it will be installed on your Windows System automatically:

Once the WSL application downloads and installs, Open it. A Command line interface will appear:

Currently, in our case, no Linux Distribution is installed. The WSL Command line cannot be used unless a Linux Distribution is installed on your Windows System.

Step 2: Enable the Windows Subsystem for Linux Feature

Before Installing a Linux Distribution, ensure that the Windows Subsystem for Linux Feature is Enabled on your Windows Operating System. Windows 11 requires the feature to be enabled. To enable the feature, search for the “Windows Features” Application. Click on the Search Icon from the Task Bar and then Search for the Windows Features Application. The “Turn Windows On and Off” Application will appear, click on it to Open it:

The Windows Features Application Window will appear where a bunch of Windows Features will be listed along with the Checkboxes for Enabling or Disabling the Feature. In the List, scroll down and look for the “Windows Subsystem for Linux” Feature:

If the “Windows Subsystem for Linux” feature is already Enabled, leave it as it is. If the Feature is Disabled, similar to our case, Click on the Checkbox to Enable the WSL Feature on your Windows 11 Operating System:

Once you Enable the Windows Subsystem for Linux Feature, click on the “OK” Button in the Windows Features to save your changes:

After you click on the “OK” Button, a Pop-up will appear asking for a System Restart to finish installing the changes. Click on the “Restart Now” button if you wish to Reboot your Windows System now:

Step 3: Download Ubuntu

Once the System Reboots, you can now Download Ubuntu. You can either install Ubuntu from the Microsoft Store or from the Windows Powershell. Both the Downloading Methods are discussed below.

Method 1: Download Ubuntu Through the Microsoft Store

To download Ubuntu through the Microsoft Store, click on the Search Box on top of the Microsoft Store Homepage and search for Ubuntu. A list of Ubuntu Versions will appear:

Click on the Version you wish to install. The Application details will open. Click on the “Install” or “Get” Button to start downloading the Ubuntu Application:

Wait for the Ubuntu Application to Download:

Once downloaded, it can now be used in the Windows Subsystem for Linux.

Method 2: Download Ubuntu Through the Windows Powershell

Ubuntu can be downloaded through the Windows Powershell. In the Windows Search, type “Windows PowerShell”. Once the PowerShell Application appears, click on the “Run as Administrator” option which will allow you to download packages:

The Windows PowerShell will open:

In the PowerShell, to list the currently installed Linux Distributions on your Windows OS, run the “wsl –list” command:

This will list the currently installed Linux distributions. In our case, no Distribution is installed yet:

Now, to download the Ubuntu Distribution, run the “wsl –install” command in the Windows PowerShell along with the Ubuntu Version.

wsl –install -d <LinuxDistroName>

In our case, we will install the Ubuntu 20.04 LTS Version with the “wsl –install” Command:

wsl –install -d Ubuntu-20.04

The PowerShell will start downloading the Ubuntu 20.04 Version and the Bar shows the Download progress:

Wait for the Ubuntu to Install:

Step 4: Configure Ubuntu

Once the Installation of Ubuntu is complete, you will have to configure your Ubuntu Operating System. The PowerShell will ask for the Ubuntu OS username:

Enter the username. In our case, we entered “sudouser”. Once you add the Username and press Enter, it will now ask for the Ubuntu User Password. Enter the Password. After the password is confirmed, Ubuntu Will be successfully installed:

After the Installation Completes, the Windows Command Line changes to the Ubuntu Command Line:

You can now use Ubuntu through the Command Line.

Step 5: Enjoy Using Ubuntu Along with Windows

You can run any Ubuntu command now as you are using Ubuntu. To update the existing packages repository in Ubuntu, run the command:

sudo apt install && sudo apt upgrade

The Command executes ensuring that Ubuntu Terminal is currently being used:

Logout from Ubuntu WSL

After you are done with using Ubuntu, you can simply return to the Windows PowerShell with the “exit” command:

The Command Line Interface changes ensuring that you are now using the Windows PowerShell:

Checking the Linux Distributions Installed

The Linux Distributions on your Windows System can also be listed in the Windows PowerShell with the “wsl” Command. To list the status of installed Distributions on your Windows System, the command used is:

In our case, only Ubuntu 20.04 is installed and the status shows that Ubuntu is currently Stopped:

Conclusion

To install Ubuntu on WSL2 on Windows, you have to install Windows Subsystem for Linux from the Microsoft Store. Once WSL installs, you have to enable the WSL Feature and then either use the PowerShell or the Microsoft Store to Download Ubuntu. This article explained every step leading to the installation of Ubuntu on WSL on Windows.



Source link