Ever since Windows 10 version 2004, Microsoft has made it possible to run Linux on top of Windows through Windows Services for Linux.
Let’s look at how to use Windows Services for Linux (WSL) to deploy Ubuntu, the default Linux distribution.
What Is WSL?
WSL, which is also supported in Windows 11, is a tool that lets you to install popular Linux distributions. Distributions include Ubuntu, Debian GNU/Linux, and SUSE Linux Enterprise Server.
WSL is accessible through PowerShell or a Command Prompt window by way of a command line tool called WSL.EXE. Entering WSL /? displays the full command syntax, as shown in Figure 1.
Figure 1. This is the command syntax for WSL.exe.
As you can see in the figure above, most of the command line arguments are geared toward installing the Windows Services for Linux. The command line option that you should note is the -d argument. This is the parameter that lets you specify the Linux distribution you want to install. You can see a list of the available distributions by entering this command:
Wsl --list --online
In Figure 2, note that Ubuntu is the very first Linux distribution on the list. It features an asterisk beside it, which indicates that Ubuntu is the default Linux distribution.
I will explain how to specify Ubuntu as the distribution to be installed so that you can see how the installation process works. (As a side note, you are not solely limited to installing the Linux distributions that are listed here. You can theoretically install any Linux distribution so long as you have the required Tarball file.)
Figure 2. This is the list the available Linux distributions.
Let’s go ahead and install Ubuntu.
Start the installation process by entering the following command:
Wsl --install -d Ubuntu
In the above command, the Install parameter tells Windows that you want to install WSL. The -D switch (which must be entered as a lowercase letter) lets you specify the distribution that you want to install – in this case, Ubuntu.
Figure 3 shows what the deployment process looks like.
Figure 3. This is how you install Ubuntu.
When the Ubuntu installation process finishes, you will need to reboot the machine.
Upon rebooting, you should see a message indicating that the Ubuntu build is installing. This installation process can take quite a while to complete. The important thing is to avoid getting impatient and closing the window, even though it looks like nothing is happening.
Eventually, the installation process should finish up and display a message prompting you to enter a new UNIX username and password. You can see what this looks like in Figure 4. Note that the username must be entered as lowercase text.
Figure 4. This is what the completion of the Ubuntu deployment process looks like.
Check Your Windows Subsystem for Linux Version
At this point, the deployment process is finished and your Ubuntu instance is ready to use. Before moving ahead, however, make sure that you are running the latest version of the Windows Subsystem for Linux.
Normally, the version won’t be an issue, but if Windows is missing updates, an older version might be deployed.
To check your version, open an elevated PowerShell window and enter the following command:
Wsl --list -v
When you enter this command, you should see that version 2 of the Windows Subsystem for Linux is in use, as shown in Figure 5.
Figure 5. Ubuntu is running on version 2 of the Windows Subsystem for Linux.
If by chance you discover that version 1 is being used, you can upgrade by entering this command:
Wsl --ser-version Ubuntu 2