Windows Subsystem for Linux (WSL) provides an easy way to run a GNU / Linux environment on Windows, without using a third-party hypervisor like VirtualBox or VMware. WSL 1 comes with a host of features, allowing users to run Linux commands, utilities, and other tools in a command line interface.
The latest version of WSL (WSL 2) can even run graphical Linux applications on Windows and uses a fully functional Linux kernel with additional features for faster system calls and better file I / O performance.
This guide will show you how to install WSL 2 on a computer running Windows 10.
Step 1: Install WSL on Windows 10
If WSL is already installed, continue to the next step. For those who don’t, enable the WSL feature and set up a distribution on your system first. To do this, go to the Start menu and search for “Activate or deactivate Windows features. ”Then select the most relevant result from the list.
A new window will open. Scroll down and check the boxes next to “Windows Subsystem for Linux” and “Virtual machine platform.” Click on Okay Carry on.
Windows will now search for and download the necessary files. When the download is complete, click Restart now to restart your machine.
Step 2: Download the WSL 2 Kernel Update
To install WSL 2, you must first download and install the latest WSL 2 kernel update.
To download: WSL 2 kernel update
Follow the on-screen instructions to install the downloaded program on your system.
Once done, launch the command prompt (run as preferred administrator) and enter the following command to set the default version of WSL to 2:
wsl --set-default-version 2
Step 3: Install a Linux distribution for WSL
Next, download a Linux distribution for WSL, either from the Microsoft Store or from the command prompt. Downloading a distribution from the Microsoft Store is easy. Just launch it, find the distro name and click To have to install it on your system.
To install a distribution via the command line, run:
wsl --install -d distroname
…or distribution name is the name of the Linux environment you want to install. You can check the available options using the command:
wsl --list --online
For the purposes of this guide, let’s install Ubuntu:
wsl --install -d Ubuntu
WSL will now download the files associated with the distribution and set up an environment for you. You may need to wait a few minutes for this process to complete.
Step 4: Change WSL Version for Existing Distributions
Since we already set the default version of WSL to 2 in step two, any new distribution you install should automatically run on WSL 2. But if not, you can also manually change the version.
To do this, you first need to check the version of WSL your distributions are currently running on. You can do this by typing:
wsl -l -v
The output will show a list of installed distributions with the corresponding WSL versions. To change the version to WSL 2, type the following command:
wsl --set-version distroname 2
For example, to switch Ubuntu to the latest WSL version:
wsl --set-version Ubuntu 2
The conversion process will start and you will have to wait a while depending on your system specifications. Once done, check the WSL version again to verify the change:
wsl -l -v
That’s it. You have now successfully installed WSL 2 on your Windows 10 machine.
Running Linux Distributions on Windows
While the Windows Subsystem for Linux may not be the most convenient way to run a Linux environment on Windows, it is by far the most suitable choice if your work revolves around the Linux command line.
If you want a distro with a full-fledged desktop running Windows, consider installing a hypervisor like VirtualBox or VMware. Unlike WSL, you will have a lot more choices for which distros to install and which desktops to customize.
Read more
About the Author