How to Run Linux alongside Windows 10 using Windows Subsystem for Linux

0
1139
Linux alongside Windows 10

For users who are new to Windows Subsystem for Linux feature on Windows 10, it allows you to install and run different kinds of Linux distros without any need of a virtual machine or another system. This feature is highly useful for developers and network administrators who want to use the number of command tools and services and to run Bash shell scripts developed in various programming languages.

In this guide, you will learn about two different ways to enable Windows Subsystem for Linux feature and to install Linux distro on your system. You will also get to know how to uninstall Linux distro when it is no longer needed.

How to Run Linux alongside Windows 10 using Windows Subsystem for Linux

You can install the Windows Subsystem for Linux using these two methods.

  1. Install Windows Subsystem for Linux using Settings
  2. Install Windows Subsystem for Linux using PowerShell

Install Windows Subsystem for Linux using Settings

Before installing Windows Subsystem for Linux, the very first thing you need to do is to enable this feature.

Enable Windows Subsystem for Linux

To do this, simply follow these steps.

  • Open Settings and select the ‘Apps’ option from the list.
  • Click the ‘Apps & features’ option from the left panel.
  • Now, click ‘Programs and Features’ link under the ‘Related settings’.
  • In the left panel, you will see the option ‘Turn Windows features on or off’, click it.

Enable Windows Subsystem for Linux

  • From the list, click ‘Windows Subsystem for Linux’.
  • Click on the OK button.
  • Then, click the ‘Restart now’ button.

After completing these steps, your Windows 10 system will be ready to install and run Linux.

Install Linux distros

Once the environment is configured, now it’s time to install the Linux distros using Microsoft Store.

  • First of all, open the Microsoft Store.
  • Now, you have to look for Linux distros want to install on Windows 10.
  • It can be Ubuntu, OpenSuse Leap 15, Kali Linux, Debian, Alpine WSL and others.

Install Linux distros

  • Select the one you want on your system.
  • Click the ‘Install’ button.
  • Now, click the ‘Launch’ button
  • The next step involves creating a username and password for Linux distro.
  • Press Enter.

Once these steps are completed, you will be able to use the installed distro.

Uninstall Linux distro

If you do not want to run Linux distro, it would be good to uninstall it. Here are its steps.

  • Open Settings.
  • Select the option ‘Apps’.
  • Click the option ‘Apps & features’ from the left panel.
  • Now, select the Linux distro you have installed on your system.
  • Click the ‘Uninstall’ button.

Uninstall Linux distro

  • Again click ‘Uninstall’ for confirmation.

After the completion of these steps, Linux distro will be removed and now you can disable Windows Subsystem for Linux.

Install Windows Subsystem for Linux using Settings

Another way to install and run the Windows Subsystem for Linux is to use PowerShell. This method is useful for those who are comfortable using command lines.

Enable Windows Subsystem for Linux

  • Open Start
  • Look for PowerShell and select the top result from the list.
  • Now, right-click it and select the option ‘Run as administrator’.
  • In order to enable the Windows Subsystem for Linux, you have to type this command.

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

  • Next, type Y and press the Enter button.
  • Now, restart your system.

Once you are done with these steps, you have to proceed further to install Linus distro available through the Microsoft Store.

Install Linux distros

Let’s start installing Linux distro with PowerShell using the following steps.

  • Open Start.
  • Look for PowerShell and select the topmost option from the result.
  • Now, right-click it and select the option ‘Run as administrator’.
  • In order to select the download folder, you need to type the command.

cd c:\PATH\TO\DESTINATION-FOLDER

  • Press Enter.
  • This command will take you to the data folder which is available in the main drive’s root.

cd c:\data

  • The next step is to download the desired Linux distro (for example Ubuntu), so type the following command and press Enter.

Invoke-WebRequest -Uri https://wsldownload.azureedge.net/Ubuntu_1604.2019.523.0_x64.appx -OutFile Ubuntu.appx –UseBasicParsing

It will download Ubuntu, but to finish the process you may have to provide the command with name and version of Ubuntu you are trying to download

  • If you want to view the installer’s name, you need to type this command and press Enter.

dir

  • To install Ubuntu, simply type this command and press Enter.

Add-AppxPackage .\APP-NAME.appx

  • It will install Ubuntu on Windows 10

Add-AppxPackage .\Ubuntu.appx

  • Open Start.
  • Search for Ubuntu and click the top option from the result.
  • Create the username for Ubuntu and press Enter.
  • Mention a password for Ubuntu and press Enter.
  • Re-enter the password and press Enter.

After completing these steps, now you are able to use Ubuntu or any distro you have downloaded and installed.

Uninstall Linux distro

To uninstall Linux distro, you have to follow these steps.

  • Open Start.
  • Look for PowerShell and select the topmost option from the result.
  • Now, right-click it and select the option ‘Run as administrator’.
  • To get the distro name, type this command and press Enter.

Get-AppxPackage *PARTIAL-DISTRO-NAME*

  • This command will search for the app package.

Get-AppxPackage *ubuntu*

If you are trying to find some other distro, do not forget to change the name in place of ‘ubuntu’ here.

  • In order to uninstall the Linux on your system, type this command and press Enter.

Get-AppxPackag FULL-DISTRO-NAME | Remove-AppxPackage

This command will remove the Linux distro package.

Get-AppxPackage CanonicalGroupLimited.Ubuntu16.04onWindows | Remove-AppxPackage

  • Also, keep in mind to change “CanonicalGroupLimited.Ubuntu16.04onWindows” with the name of the distro you want to remove.

After these steps are completed, you can now disable Windows Subsystem for Linux on your Windows 10 system.