You are here

WSL - Windows Subsystem for Linux

Error message

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in drupal_strip_dangerous_protocols() (line 1458 of /home2/crephoto/public_html/techblog/includes/common.inc).

Since this blog is focused on the Darwin kernel of MacOS, I don't make many Windows-related posts. A couple of years ago, however, a friend pointed me to the Windows Subsystem for Linux, a Linux environment which can be installed on Windows 10 systems. You even have a choice of distros. I installed WSL on all of my lab computers, but the process is still a bit involved, so I thought I'd document it here.

Prior to starting, check that your system is supported. WSL will only run under Windows 10 x64 systems on version 1903 or higher, with build 18362 or higher. To check your build version, type WIN+R, then run "winver".

I will summarize the installation steps below, details of which can be found at Microsoft's Web Site

1. Enable WSL. You'll need to run the command shell with administrator privileges.

C:\> dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2. Enable Virtual Machine

C:\> dism /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

3. Download and run the latest Linux kernel package update.

Although we used the "norestart" option, I found I had to restart Windows so that wsl would be in the path prior to the next step. Logging out and back in might also work.

4. Set WSL 2 as your default version

C:\> wsl --set-default-version 2

5. Install the Linux distro of your choice from the Microsoft store. I'm partial to Ubuntu, but Debian and SUSE are also available as I am writing this. If you're a hacker, you might like to try Kali. If you do choose Ubuntu, I recommend selecting the newest "LTS" (Long-Term Support) version.