PROBLEM
A long time Windows user needs to run linux applications and development tools. The user does not wish to dual boot and must retain the ability to run Windows as their "daily driver" to ensure compatibility with customer and/or employer needs. Traditional virtual machines are also not an option for this user because of performance concerns.
RESOLUTION
Install Windows Subsystem for Linux! This is a feature of Microsoft Windows 10 & 11 that allows developers to run a Linux environment without needing a separate virtual machine and without exposing themselves to the possible risks of dual booting.
PREREQUISITES
Note: the author was using Windows 11 21H2 (Build 22000.2538) at the time of this writing.
- Windows 10
version 2004 and higher (Build 19041 and higher) - Windows 11
all versions
PROCEDURE
STEP 1: Start Windows PowerShell with Administrator privileges.
STEP 2: Execute "wsl -l -v" to list the version and status of any installed WSL2 Linux distributions.
NOTE: there may appear to be a Windows Subsystem for Linux distribution installed if you are already a user of Docker Desktop for Windows. If this is the case you might be able to run WSL and get a linux command prompt, but it will not be a full distribution.
Even if "docker-desktop" or something like it appears in the list of installed distributions (see sample output below), a full linux distribution will need to be installed.
PS C:\Users\Dj> wsl -l -v NAME STATE VERSION docker-desktop Stopped 2 docker-desktop-data Stopped 2
STEP 3: With the latest Windows releases, it is possible to configure your Windows machine using a single command. Use the following command to instruct Windows to install WSL2 with Ubuntu (by default).
PS C:\Users\Dj> wsl --install
STEP 4: Execute "wsl -l -v" to show the status of the installed WSL2 linux distributions.
PS C:\Users\Dj> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
docker-desktop Stopped 2
docker-desktop-data Stopped 2
STEP 5: Ubuntu should now be ready to run on your Windows machine. This is not a virtual machine in the traditional sense. This virtual machine is not emulated by Windows. The linux kernel executes alongside Windows and is a "true" machine that has full, yet properly partitioned, access to system hardware.
NOTE: Some users that already have Docker Desktop installed may need to specify Ubuntu as the distribution of choice. In this situation, the "-d" option must be used to indicate the desired distribution.
Execute "wsl --list --online" (or, more simply, "wsl -l -o") to see a list of available distributions.
PS C:\Users\Dj> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
...
Execute "wsl --install -d Ubuntu-24.04" to instruct Windows to install the latest LTS version of Ubuntu under WSL.
PS C:\Users\Dj> wsl --install -d Ubuntu-24.04
STEP 6: After the installation has completed, try out the distribution by typing "wsl" at the PowerShell command prompt.
PS C:\Users\Dj> wsl
dj@KC7ZXY-5950X:/mnt/c/Users/Dj$ cd ~
dj@KC7ZXY-5950X:~$
TIP: For more efficient use of WSL, explore "Windows Terminal" from the Windows Store. It was developed as a replacement for Windows Console and it has a lot more power behind it. It can be configured to run Windows command shells, PowerShell prompts, and any of the installed WSL/Linux distributions in "real" terminals, simultaneously, side-by-side, in multi-tabbed windows.
Everything, everywhere, all-at-once!
STEP 7: Execute "wsl -l -v" again to show the status of the installed WSL2 Linux distributions. Now you should see that Ubuntu is in a Running state.
PS C:\Users\Dj> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop Stopped 2
docker-desktop-data Stopped 2
kali-linux Stopped 2
SPECIAL BONUS: When installing GUI applications within one of your linux distros, the application will show up as a Windows application within the normal Windows menus and the Taskbar.
STEP 8: If you have reached this point and were able to execute the wsl commands and get the Linux kernel running, grab another cup and enjoy the rest of the day!
CONCLUSION
While it is preferrable when a full desktop or laptop computer can be dedicated to a barebones installation of linux, the partnership between Microsoft and Canonical has produced something with WSL (and WSL2) that, quite frankly, astounds me. I have found it so useful to have WSL2 allowing both Ubuntu and Kali running alongside Windows (and each other!) that it is difficult to imagine operating any other way.
Command List:
wsl -l -v
wsl --install
wsl --list --online
wsl -l -o
wsl --install -d Ubuntu-24.04
wsl
cd ~
sudo apt install gimp
gimp
Helpful Resources: