Using Windows Subsystem for Linux (WSL), users can install any Linux distribution directly on their Windows machine without having to install a virtual machine or through dual booting. And if you have Windows 11, then you can also run Graphical applications directly on Windows.
In this tutorial, we will look at the complete procedure of Installing Ubuntu on Windows WSL2, note that I’m using Windows 11 in this tutorial, but you can also follow along if you have Windows 10.
Install WSL2
From the start Menu, search for ‘PowerShell’ application and launch the application using Administrator privileges.
In Windows PowerShell, type the following command and press Enter :
wsl --install
Wait for the WSL kernel and GUI app support (on Windows 11) to be installed, and then finally reboot your PC for changes to take effect.
Close the PowerShell window after the command stops running, and then reboot your system for the changes to take effect.
Make WSL2 the Default version
Now, open PowerShell again with Admin privileges and run the following command :
wsl --set-default-version 2
Install Ubuntu
If you want any other version of Ubuntu, then you can list all available distributions and specify the version which you want to install using this command:
wsl --list --online
wsl --install -d Ubuntu-VERSION
To Install the latest Ubuntu, run:
Post Installation configurations
Once installed, A second Ubuntu Terminal will open (If it does not, simply search and launch it from your Start menu), and you will be asked to create a User account and Password on Ubuntu :
After installation, It is recommended that you fully update your Ubuntu by typing the following command:
sudo apt update && sudo apt full-upgrade
Install Applications
Now that you have Installed Ubuntu on your machine, you can begin installing applications using the sudo apt install appname
command, for example, here, I have installed the Ranger file manager :
sudo apt install ranger
Summary
WSL is definitely a boon for developers who are interested in developing cross-platform applications, as they do not have to use a Virtual Machine or dual boot their system every time they have to test a new feature that they added to their application. Now with the support for GUI applications, even a moderately techie person can now access the huge library of Linux-only command line applications.