How to install Windows Subsystem for Linux (WSL) in Windows 10?

Irving Juárez
4 min readJun 19, 2021

--

Windows Subsystem for Linux lets developers run a GNU/Linux environment, including most command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup. In this article you will learn how to install Ubuntu or any other Linux-based Operating System in your Windows pc.

In other words, you can have a Linux-based operating system working on your pc. Among the advantages are:

  • Run common command-line tools such as grep, sed, awk, or other ELF-64 binaries.
  • Run Bash shell scripts
  • Use edit text tools such as: vim, emacs, tmux
  • Languages: NodeJS, Javascript, Python, Ruby, C/C++, C# & F#, Rust, Go, etc.
  • Services: SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL.
  • Install additional software using your own GNU/Linux distribution package manager.

Installing WSL

There are two ways how you can install WSL. The simplified and the manual way.

Simplified

Everything you need to do is open a command window with admnistrator privileges and run the command wsl —-install, after a restart you will be able to use WSL.

In order to do this, you need to join the Windows Insider Program and install a preview of the Windows 10 (OS build 20262 or higher). Otherwise, you would require to install WSL manually.

Manual

Step 1. Enable the Windows Subsystem for Linux

You must first enable the “Windows Subsystem for Linux” optional feature before installing any Linux distributions on Windows.

Open PowerShell as Administrator and run:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Step 2. Check requirements for running WSL 2

In order to have WSL 2, you must be running Windows 10.

  • For x64 systems: Version 1903 or higher, with Build 18362 or higher.
  • For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.

Builds lower than 18362 do not support WSL 2. Use the Windows Update Assistant to update your version of Windows.

In order to know what version you have, select Windows+R and type winver. You will see a windows showing you the version you have.

Step 3. Enable Virtual Machine feature.

Before installing WSL 2, you must enable the Virtual Machine Platform optional feature. Your machine will require visualization capabilities to use this feature.

Open PowerShell as Administrator and run:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart your machine to complete the WSL install and update to WSL 2.

Step 4. Download the Linux kernel update package.

  1. Download the latest package: WSL2 Linux kernel update package for x64 machines
  2. Run the update package downloaded in the previous step. (Double-click to run — you will be prompted for elevated permissions, select ‘yes’ to approve this installation.)

In the next step we set the WSL 2 as the default version. If you want to set WSL 1 as your default version, just skip step 5.

Step 5. Set WSL 2 as your default version

Open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:

wsl --set-default-version 2

Step 6. Install your Linux distribution of choice

  • Open the Microsoft Store and select your favorite Linux distribution. In my case I am going to select Ubuntu.
  • From the distribution’s page, select “Get”.

The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.

You will then need to create a user account and password for your new Linux distribution.

CONGRATULATIONS! You’ve successfully installed and set up a Linux distribution that is completely integrated with your Windows operating system!

--

--