Installing Windows Subsystem for Linux (WSL) Using PowerShell

·

2 min read

Introduction: The Windows Subsystem for Linux (WSL) is a remarkable feature provided by Microsoft that allows you to run a Linux environment directly on your Windows machine. By leveraging PowerShell, we'll guide you through the process of installing WSL using the "Enable-WindowsOptionalFeature" command. Let's get started!

Step 1: Open PowerShell as Administrator To begin, right-click on the Start menu and select "Windows PowerShell (Admin)" to launch PowerShell with administrative privileges. This is necessary to execute the required commands.

Step 2: Check System Requirements Before proceeding, ensure that your system meets the necessary requirements. You need to have Windows 10 or Windows Server 2019 (64-bit) with the latest updates installed.

Step 3: Enable WSL Feature In PowerShell, enter the following command and press Enter:

Copy codeEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

This command will enable the Windows Subsystem for Linux feature on your system. It may prompt you to restart your computer to complete the installation.

Step 4: Install a Linux Distribution After restarting your computer, it's time to install a Linux distribution of your choice. Microsoft provides various distributions, such as Ubuntu, Debian, and openSUSE, that can be downloaded from the Microsoft Store. To install a distribution, follow these steps:

  1. Open the Microsoft Store from the Start menu.

  2. Search for your preferred Linux distribution (e.g., "Ubuntu") and select it from the search results.

  3. Click on the "Install" button to initiate the installation process.

  4. Wait for the installation to complete. Once finished, you'll have a fully functional Linux environment on your Windows machine.

Step 5: Launching and Managing WSL To launch your installed Linux distribution, you have a few options:

  1. Open the Start menu and search for the distribution's name (e.g., "Ubuntu"). Click on the search result to launch it.

  2. Alternatively, you can launch it from the command line by opening PowerShell or Command Prompt and typing the distribution's name (e.g., "ubuntu").

Once launched, you can interact with your Linux distribution just like any other Linux environment. You can install packages, run commands, and access files from Windows within the Linux file system.

To update or manage your installed Linux distributions, you can use various WSL commands or utilize graphical interfaces provided by the respective distributions.

Conclusion: By following the steps outlined above, you can easily install the Windows Subsystem for Linux (WSL) using the "Enable-WindowsOptionalFeature" command in PowerShell. Enjoy the flexibility and power of Linux alongside your Windows environment, opening up new possibilities for development, system administration, and more.