Easily install Debian Linux on Windows using WSL2

A Guide To Install Debian On Windows Using WSL2

Debian is one of the oldest Linux distributions available that is currently being maintained actively. Ubuntu, which is the most popular Linux distribution, is based upon the experimental version ‘Sid’. And Ubuntu in turn acts as a base for numerous operating systems such as Linux Mint, Pop_OS!, Linux Lite, etc. Debian is mostly used by servers around the world because Debian is very stable.

Microsoft has recently updated their WSL or Windows Subsystem for Linux to version 2 (termed WSL2) and the Linux instance installed is more usable for all users now. In this tutorial, we will try to install this Debian Linux on our Windows machine using WSL2.

Enable/Install WSL2

If you are using Windows 11, WSL2 is already installed on your system, and you just have to enable it. We will discuss this after learning to install this on Windows 10. Windows 10 users have to first enable WSL on their system. From the Start Menu, search and run Turn Windows features on or off, and launch it. From Here, enable ‘Virtual Machine Platform‘ and ‘Windows Subsystem for Linux‘ and click OK and restart your PC.

Turn On WSL2
Turn On Windows Subsystem For Linux

Now, search and open ‘PowerShell’ application and right-click upon it to run it as administrator. Now, just type the following command and press the Enter key on your keyboard :

Run Powershell As Administrator From The Start Menu
Run PowerShell As Administrator From The Start Menu
wsl --set-default-version 2
wsl --list --online

If you are using Windows 11, open the ‘PowerShell’ application as Administrator and then run the following command :

wsl --set-default-version 2
wsl --list --online

Installing Debian on WSL2

List Available Distributions On WSL2 1
List of Available Distributions On WSL2

Now, the default version that is installed on your PC is Ubuntu (marked by an asterisk here), to install Debian, you can run the following command :

wsl --install -d Debian
Installing Debian Using WSL2
Installing Debian Using WSL2

If prompted, you should also reboot your system.

Post installation tweaks

Once you restart your PC, you will see a Terminal window waiting for you asking you to create a Username and Password.

Enter Your Username And Password And You Are Now Done With The Installation
Enter Your Username And Password And You Are Now Done With The Installation

Now, you should also update your system to the latest version using the apt command, type the following in your Debian Machine :

sudo apt update && sudo apt full-upgrade
Update Your Debian Installation
Update Your Debian Installation

Summary

While WSL2 provides the complete command line experience to any developer/user, it is still not a complete replacement for actual Installation on a Virtual machine or on bare metal. Applications do not have hardware acceleration and hence drain the battery more and so on. It is still a good decision from Microsoft as many people will have the exposure to Linux command line and maybe even encourage people to fully switch to the Linux Desktop

References

Microsoft’s Official WSL2 Documentation