WindowsMacSoftwareSettingsSecurityProductivityLinuxAndroidPerformanceConfigurationApple All

How to Install Windows Subsystem for Linux on Windows 10

Edited 3 weeks ago by ExtremeHow Editorial Team

Windows 10Windows Subsystem for LinuxInstallationSystemDevelopmentFeaturesConfigurationCLIToolsSoftware

How to Install Windows Subsystem for Linux on Windows 10

This content is available in 7 different language

Windows Subsystem for Linux (WSL) is a remarkable feature that allows you to run a Linux environment directly on Windows 10 without having to set up a virtual machine or dual boot system. It is especially useful for developers and system administrators who want to use Linux command-line tools on a Windows machine. In this comprehensive guide, we will explain the entire process of installing WSL on Windows 10 step by step. Whether you are an experienced programmer or new to Linux, this guide will help simplify the process.

1. Introduction to windows subsystem for linux

Windows Subsystem for Linux (WSL) provides a compatibility layer that lets you run Linux binary executables natively on Windows. This means you can run tools like bash, utilities like grep and sed, and even software installations directly from your Windows 10 operating system. WSL is especially beneficial for developers who work on cross-platform applications or who need Linux-specific tools.

There are two versions of WSL: WSL 1 and WSL 2. WSL 2 has a full Linux kernel and offers improved performance and full system call compatibility. Our focus will be on installing WSL 2.

2. Pre-requisites

Before you install WSL, make sure you meet the prerequisites. Here's what you need:

3. Step-by-step installation process

3.1 Enabling WSL

The first step to turn on WSL on your system is to enable the WSL feature in Windows 10. Follow these steps:

  1. Open the Start menu and search for PowerShell.
  2. Right-click on Windows PowerShell and select Run as administrator.
  3. In the PowerShell window, type the following command to enable WSL, and then press Enter:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  4. Restart your computer when prompted to apply the change.

3.2 Configuring WSL 2

After enabling WSL, you may want to use WSL 2, which offers better performance. To use WSL 2, you need to configure your system as follows:

  1. In PowerShell, type the following command and press Enter to enable the Virtual Machine Platform feature:
    Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
  2. Make sure your system is configured to use WSL 2 as the default version:
    wsl --set-default-version 2
  3. Restart your computer if necessary to complete the configuration.

3.3 Downloading the Linux distribution

After setting up WSL, it's time to download and install a Linux distribution. You can choose from several distributions available on the Microsoft Store such as Ubuntu, Debian, Kali Linux, and more. Follow these steps:

  1. Open the Microsoft Store from the Start Menu.
  2. Search for your favorite Linux distribution (for example, "Ubuntu") in the store's search bar.
  3. Click on the distribution and select Get or Install.
  4. After installation, a notification will display prompting you to launch the installed Linux distribution.

You can install multiple Linux distributions and even run them simultaneously using WSL. Each distribution is managed independently, providing flexibility in configuration and installed tools.

3.4 Initial setup of your Linux distribution

Once the Linux distribution is installed, you’ll need to perform some initial setup steps, especially if you’re setting it up for the first time:

  1. Open the installed distribution from the Start menu. This will open a console window, and the first boot may take a few minutes as it sets up the Linux environment.
  2. Follow the on-screen instructions to create a new user account. You will be asked to enter a user name and password. This does not have to match your Windows account, but it will be your Linux user identity.
  3. Once setup is complete, the Linux command line shell will be ready to use.

With the Linux distribution set up, you can now execute Linux commands directly from your Windows environment. Simple commands like ls, cd, or touch will work, as well as more complex commands, depending on what you install next.

4. Updating and installing applications

To ensure that your Linux subsystem is up-to-date and able to run the applications you want, you are advised to update your Linux packages. Use the following command:

sudo apt update && sudo apt upgrade

This command will update the package repository and upgrade all the outdated packages.

You can install new applications just like you would on any Linux machine, using a package manager like apt or yum. For example, to install curl tool, you could run:

sudo apt install curl

5. Customizing WSL

There are many ways to customize your WSL to suit your needs. Here are some suggestions:

6. Uninstalling WSL

If you want to completely uninstall a specific Linux distribution or WSL, you can easily do so from the Settings app or using PowerShell. Here's how:

6.1 Uninstalling a Linux Distribution

  1. Open Settings and go to Apps.
  2. Under Apps & Features, find the Linux distribution you want to remove, click on it, and select Uninstall.

6.2 Disabling WSL

  1. Open PowerShell as administrator.
  2. Enter the command:
    Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  3. Restart your computer to finalize the changes.

7. Conclusions

WSL has paved the way for seamless interaction between Windows and Linux environments, eliminating the need for complicated dual-boot setups or slow virtual machines. Through this guide, you have learned how to enable and install WSL on Windows 10, configure it for best performance, and even customize it to your needs. You should now have a complete Linux environment running smoothly alongside your Windows system, ready to tackle various development or system administrative tasks.

If you find anything wrong with the article content, you can


Comments