How to install Linux Bash Shell on Windows 10

The "Quick Guide" is the fastest way to do what you intend to do without exploring in-depth details. This guide is recommended for moderately advance users who are in a hurry. 

The "Details Guide" gives you far more information, in-depth knowledge of the steps you will be following along with the screenshots so that you understand and learn what you are doing. This guide is recommended for learners, basic and intermediate users.

Install Linux Bash Shell on Windows 10

Quick Guide:

Step 1: You must enable "Windows Subsystem for Linux (WSL)" before you can install & run Linux on your Windows 10. To enable it,  open PowerShell as "Administrator" and run the following command:
       

  Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

 
Step 2: Restart your computer when prompted. Simply Press "y" to do that.

Step 3: Download and install Linux distribution of your choice from the Microsoft Store. (This step requires that you have Windows 10 "Fall Creators Update" or later version). If you have a prior version of Windows 10 Fall Creators Update, please refer to our "Details Guide" section.

Open the "Microsoft Store" and search for "Linux". From the search results, choose your favourite Linux distribution.

Click on a Linux distribution you want to run and it will take you to the details page. From there, click on the "Get" button. It will start downloading the Linux "distro" of your choice.

Step 4: Once installed, click on the "Launch" button and it will complete the installation process. This may take a few minutes. After the process is done, you will be asked to enter a "Username" and "Password" (twice for confirmation) that you will be using for your login to the Linux OS.

That's pretty much it. If your installation was not completed due to one or more errors, please refer to the bottom of this article to troubleshoot and fix the problem(s).


Details Guide:

What is Bash Shell on Windows?
Bash Shell on Windows provides a subsystem to run Linux on top of it. It is not a virtual machine, a container or Linux software compiled for Windows. With it, you install a Linux distro and run Linux commands inside a Windows 10 environment without a second device or virtual machine. This option does not offer Linux GUI interface, as it would with a full Linux Desktop environment setup, but offers full features to learn Linux or Unix commands.

Limitations: Installing Linux on WSL has some limitations. It doesn’t support background server software, graphical Linux desktop applications and a few command-line applications.

Let's get started:
We assume that you want to try a popular Linux distribution such as Debian, Ubuntu or OpenSuse without the complexity of setting up a virtual machine or installing it in a different machine. When you install your choice of Linux distribution using Windows Subsystem for Linux (WSL), it creates a lightweight environment that allows you to run Linux on top of Windows environment. So, let's go ahead and install your favourite Linux on your Windows 10 environment.

Step 1 - Install/Enable the Windows Subsystem for Linux (WSL):

To run Linux on your Windows 10 OS, first, enable "Windows Subsystem for Linux (WSL)". You can do it both from the Windows "PowerShell" or the "Turn Windows features on or off" Utility.

Method 1: To enable "Windows Subsystem for Linux" from "PowerShell", open "Start Menu" and then type "Windows PowerShell". Run it as Administrator.

Windows PowerShell

Within the PowerShell, run the following command:
       

  Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

 
Run command on the PowerShell

Once you run the command, it would enable "Windows Subsystem for Linux" feature and prompt you to restart the computer. Press, "Y" or "y" to restart the computer.

Method 2: Alternatively, you can enable "Windows Subsystem for Linux (WSL)" from the "Turn Windows features on or off" utility without running the command from the Windows PowerShell. To do so, open "Start Menu" and then type "Turn Windows features on or off".

Turn Windows features on or off

From the "Turn Windows features on or off" screen, enable the "Windows Subsystem for Linux" option as shown in the below image, and press "OK". It will ask you to restart your computer. Save all unsaved documents and allow your computer to restart.



Well done! Your Windows now has "Windows Subsystem for Linux (WSL)" feature enabled to let you install and run the Linux on that computer.

Step 2 - Install the Linux distribution you want to run and use:

In this stage, you need to download and install your preferred Linux distribution. For this, you can follow one of the two methods:

     Method 1 - Download and install Linux from the Microsoft Store (Easy & recommended method)
     Method 2 - Download and install Linux from the Command-Line/Script (Moderately difficult and not recommended for newbies):
Let's explore both the methods.


Method 1 - Get Linux from the Microsoft Store:
To install Linux from Microsoft store, you need "Windows 10 Fall Creators Update" and later versions of Windows, more specifically, Windows build 16215 or later. We will assume that your Windows is up-to-date to download the Linux distro from the Store.

If you are not sure which OS and Windows built you have, you can check this helpful article to check your build from Microsoft.

To download and install Linux distribution of your choice, open the "Microsoft Store" from the Start Menu of your Windows and search for "Linux".

Download Linux from Windows Store

Click on the Linux distribution you want to install. Your options are pretty much one of the following (more options would be included in the future):

Ubuntu 16.04 LTS
Ubuntu 18.04 LTS
Debian GNU/Linux
Kali Linux
Fedora Remix for WSL
Pengwin
Pengwin Enterprise
Alpine WSL
OpenSUSE Leap 15
OpenSUSE Leap 42
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 15

Note: Whether a Linux distribution is free to download and use, or require money is clearly written under the distribution image. You can download pretty much all popular Linux distribution (including Ubuntu and Debian) for free.

After you click on the Linux distro of your choice, the details page would open. From there click on the "Get" button. The download will start and it may take a few minutes depending on the speed of your internet connection. Once the download is done. You will see the "Launch" button.

Download Debian

Method 2 - Get Linux from the Command-Line/Script:
If you may not be able to (or want to) download the Linux distribution of your choice from the Microsoft Store, you can follow this method to install and run Linux on your Windows 10 machine.

First, download the Linux distribution of your choice using either "PowerShell" or "curl".

Installing Linux using PowerShell:

To download a Linux distribution using PowerShell, use the Invoke-WebRequest "cmdlet". Here's the instruction to download Ubuntu 18.04. The same instructions could be used to download other Linux distros.
       

  Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing

 

Your other download options are:

Instruction to download Debian GNU/Linux:
       

  Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile Ubuntu.appx -UseBasicParsing

 

Instruction to download Kali Linux:
       

  Invoke-WebRequest -Uri https://aka.ms/wsl-kali-linux-new -OutFile Ubuntu.appx -UseBasicParsing

 

Instruction to download OpenSUSE Leap 42 Linux:
       

  Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile Ubuntu.appx -UseBasicParsing

 

Tips: Just replace the ... in "Invoke-WebRequest -Uri https://aka.ms/wsl-... -OutFile Ubuntu.appx -UseBasicParsing" to install your desired Linux distro.

Installing Linux using curl:

If your Windows 10 includes the popular curl command-line utility, you can download your preferred Linux distro using the following command. Here's the instruction to download Ubuntu 18.04. The same instructions could be used to download other Linux distros.
       

  curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-ubuntu-1804

 
Your other download options are:

Instruction to download Debian GNU/Linux:

       

  curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-debian-gnulinux

 

Instruction to download Kali Linux:

       

  curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-kali-linux-new

 

Instruction to download OpenSUSE Leap 42 Linux:

       

  curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-opensuse-42

 
Tips: Just replace the ... in "curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-..." to install your desired Linux distro.


Step 3 - Finalise/Complete initialization of your Linux distribution:

After you "Launch" your Linux distribution, it will take a few minutes to complete the installation and initialisation. The first time a newly installed Linux distro runs, a Console window will open, and it will automatically finalise the installation.

At this stage, you will be asked to enter a "Username" and "Password". Note that, this username can be anything you want and does not necessarily the username you use to run your Windows Operating System. You will need to enter your password twice, so enter the same password both of these times. Remember the password or save it at a secured location.

Finalise installation of Linux

Great job! Your Linux distribution is now installed and ready to be used. To launch it, simply find it in the start menu of your windows. For convenience, you might want to pin it to your Start menu, and/or to your taskbar.



Troubleshooting:

Error 1:  WslRegisterDistribution failed with error: 0x8007019e
The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again.

If you see this error message while trying to run Linux from your Windows 10, it's because "Windows Subsystem for Linux (WSL)" is not enabled. And when you press any key, the application closes immediately and you can't run Linux.

WslRegisterDistribution failed with error: 0x8007019e

Solution: The reason for this error is that the "Windows Subsystem for Linux" is not enabled in your computer. You must enable this feature before you can run Linux on Windows 10. You can enable it from "Step 1 - Install/Enable the Windows Subsystem for Linux (WSL):" from this article.

Don't worry. You can do this even after you have installed Linux from Windows Store.


Error 2:  Installation failed with error 0x80070003

This error may trigger when you try to download a Linux distribution from the Windows Store but it is not stored on your system drive (i.e. C drive). The Windows Subsystem for Linux only runs on your system drive (usually this is your C: drive).

Solution: Make sure your Linux distribution is stored on your system drive (usually C: drive).

Open Settings -> Storage -> More Storage Settings: Change where new content is saved.

Installation failed with error 0x80070003

Comments