blog posts

How To Install Windows Linux (WSL) Subsystem In Windows 10

How To Install Windows Linux (WSL) Subsystem In Windows 10

Using The Windows Linux (Wsl) Subsystem, You Can Install Linux Alongside Windows 10 Without The Need For A Second Device Or Virtual Machine.

Windows Linux (Wsl), In Windows 10, the Windows for Linux (WSL) subsystem is a feature that provides a lightweight environment for installing and running Linux-supported versions (Ubuntu, OpenSuse, Debian, and others) without the need for a complex licensed machine or PC configurations. It is not separate.

You will not have a graphical interface in WSL. Still, network developers and admins can use Linux command-line tools and services such as vim, tmux, academics, sshd, Apache, and MySQL, and run Bash shell scripts written in Python, Ruby, C#, f#, and many command-line applications…

This tutorial will teach you how to install the Windows subsystem for Linux using the Settings and PowerShell applications. We will also provide instructions for downloading and installing Linux distributions and steps to remove unnecessary components of the open-source environment properly.

Install the Windows Linux subsystem using Settings

If you want to run Linux distributions on Windows 10, you must enable the WSL (Windows Subsystem for Linux) feature before downloading and installing the desired version of Linux.

Activate the Linux Windows subsystem using Settings

To install WSL using Windows 10 Setting, follow these steps:

1. Open Settings.

2. Click Apps.

3. Under the Related settings section, click Programs and Features.

WSL activation

4. Click Turn Windows features on or off in the left panel.

Disable features

5. Check the Windows Subsystem for the Linux option.

Linux subsystem

6. Click the OK button.

7. Click the Restart now button.

After completing the above steps, the environment for downloading and installing Linux distributions for Windows 10 is set.

Install Linux distributions using the Microsoft Store

Follow the steps below to install the Linux distribution on Windows 10:

1. Open the Microsoft Store.

2. Search for the desired Linux distribution. Some of the available distributions are:

  • Ubuntu
  • OpenSuse Leap 15
  • Kali Linux
  • Debian
  • Alpine WSL
  • Suse Linux Enterprise 12

3. Select the desired Linux distribution.

Select a Linux distribution

4. Click the Get or Install button.

Install Linux

5. Click the Launch button.

6. Create a username for the Linux distribution and press Enter.

7. Enter the desired password for distribution and press Enter.

Install Linux subsystem

8. Repeat the password and press Enter to confirm.

After completing the above steps, you can use distributions without a graphical interface.

Delete Linux distributions using Settings

If you no longer need to run Linux on your device, it is recommended that you delete distributions and disable WSL. Follow the steps below to remove the Linux distribution:

1. Open Settings.

2. Click Apps.

3. Click Apps & Features.

4. Select the desired distribution under the Apps & Features section (for example, Ubuntu).

5. Click the Uninstall button.

Remove Linux

6. Click the Uninstall button to confirm.

After completing the above steps, the Linux distribution will remove, and you can follow the steps to disable WSL.

Disable the Linux Windows subsystem using Settings

Follow the steps below to disable WSL on Windows.

1. Open Settings.

2. Click Apps.

3. Under the Related settings section, click Programs and Features.

Disable wsl

4. Click Turn Windows features on or off from the left panel.

Features off

5. Uncheck Windows Subsystem for Linux.

Remove windows subsystem

6. Click the OK button.

7. Click the Restart now button.

After completing the steps, WSL will be removed from your device.

How to install the Linux Windows subsystem using PowerShell

If you do not have access to Windows graphics, or if you prefer the command line, you can use PowerShell to activate the Windows Linux subsystem, download and install its distributions, and undo all changes.

Activate the Windows Linux subsystem using PowerShell

Follow the steps below to install the Windows subsystem for Linux using PowerShell:

1. Open Start.

2. Search for PowerShell, right-click on the first result, and select Run as administrator.

3. Type the following command to activate the Linux subsystem and press Enter:

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

 

wsl with powershell

4. Type the letter Y and press Enter to confirm, and then restart the computer.

After completing the steps, you can follow the instructions to download and install any Linux-compatible distribution through the Microsoft Store.

Install Linux distributions using PowerShell

To download and install Linux distributions (including Ubuntu) with PowerShell, follow these steps:

1. Open Start.

2. Search for PowerShell, right-click on the first result, and select Run as administrator.

3. Type the following command to select the download folder and press Enter:

cd c: \ PATH \ TO \ DESTINATION-FOLDER

With this example, you will be redirected to the data folder on the primary root drive:

cd c: \ data

4. Type the following command to download Ubuntu and press Enter:

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

Download ubuntu powershell

The above command downloads the Ubuntu version 16.04, But you may need to update the command with the name and distribution you want to download.

Note: The link in this step and the link in the screenshot look different, But they are the same. The link in the screenshot is a shortened version.

5. Type the following command to display the actual name of the installer and press Enter:

dir

Type the following command to install Ubuntu 16.04 and press Enter:

Add-AppxPackage. \ APP-NAME.appx

This example installs the Ubuntu distribution on Windows 10:

Add-AppxPackage. \ Ubuntu.appx

Install Ubuntu

7. Open Start.

8. Search for a new Linux distribution (for example, Ubuntu) and click on the first result to run.

9. Create a username for the Linux distribution and press Enter.

10. Enter the desired password and press Enter.

Enter the Linux username and password

۱۱. Repeat the password and press Enter to confirm.

After completing the steps, you can use Ubuntu or any other distribution without a graphical user interface.

Remove the Linux distribution using PowerShell.

If you want to reset the changes, you must delete the Linux distributions before disabling WSL.

1. Open Start.

2. Search for PowerShell, right-click on the first result, and select Run as administrator.

3. Type the following command to find the name of the distribution and press Enter:

Get-AppxPackage * PARTIAL-DISTRO-NAME *

This example search for the application package includes the word Ubuntu in the name:

Get-AppxPackage * ubuntu *

Eliminate Linux distribution with PowerShell

On the command line, be sure to replace the phrase Ubuntu with the name of the distribution.

4. Type the following command to uninstall the Linux version installed on your computer and press Enter:

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

This example removes the Ubuntu package from Windows 10:

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

Remove Ubuntu package

In this command, be sure to replace CanonicalGroupLimited.Ubuntu16.04onWIndows with the name of the distribution.

After completing the above steps, you can disable the Windows Linux subsystem on your computer.

Disable the Linux Windows subsystem using PowerShell

Follow these steps to disable WSL using PowerShell:

1. Open Start.

2. Search for PowerShell, right-click on the first result, and select Run as administrator.

3. Type the following command to activate the Linux subsystem and press Enter:

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

Disable Windows subsystem

4. Type the letter Y and press Enter to confirm; Then restart your computer.

After completing the above steps, the Linux environment on your computer will be disabled.