Open In App

Install Windows Subsystem for Linux (WSL)

Last Updated : 04 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment on Windows, without the overhead of a traditional virtual machine or dual boot setup. This incorporates Linux-like functionality on Windows OS without the overhead of running another OS in parallel, therefore, reducing resource consumption. This makes WSL a go-to choice for people wanting to switch between the two Operating Systems or ones who want to get Linux-like functionality in their Windows OS. WSL2 is a new version of the architecture that allows you to use Linux on top of Windows 10 natively and replaces WSL. In this article, you will learn how to install WSL2 on Windows 10. 

Setup of Windows Subsystem for Linux:

Here are some steps to install Windows Subsystem for Linux. We are installing WSL on Windows 10.

Step 1: Open the start menu in Windows by pressing the [Win] key or clicking the bottom right icon of the Windows desktop.

Windows Subsystem for Linux

Start menu for Windows Subsystem for Linux

Step 2: Type cmd. A result similar to this would appear.

Windows Subsystem for Linux

Opening cmd to install Windows Subsystem for Linux

Step 3: Click on the Run as administrator option on the right side of the taskbar

Windows Subsystem for Linux

Run as administrator cmd

Step 4: A new window would have appeared similar to this

Windows Subsystem for Linux

cmd

Step 5: Type the following command and press Enter to install Windows Subsystem for Linux.

wsl --install
Windows Subsystem for Linux

`wsl — install` command to Install Windows Subsystem for Linux

Step 6: The WSL2 installation process has begun. It will install the Linux Kernel during this process. After the process has been completed the user gets acknowledged that Windows Subsystem for Linux (WSL) has been installed.

Windows Subsystem for Linux

Windows Subsystem for Linux (WSL) has been installed

Step 7: Now WSL has been successfully installed onto the Windows 10 Operating System. Now restart your Operating System. Upon restarting you could use Windows Subsystem for Linux (WSL2). 

Note: By default, the Ubuntu distribution gets installed in Windows Subsystem for Linux (WSL2). If you want any specific distribution, you could get so by replacing the command.

wsl --install
wsl --install -d DIST

Where DIST is the name of the distribution you are wanting to install. 

Enabling Virtual Machine:

As mentioned earlier, WSL2 is a small virtual machine, so Windows has to accommodate it. If this is already enabled, skip the process and restart your PC to make sure it’s ready for installation. The easiest way to do this is with PowerShell. As an administrator, he opens PowerShell and enters the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Now you can reboot your PC and be able to do anything on WSL.

Installing Linux Packages:

You can also install Linux packages here. Popular apt and apt-get commands are available. For example, let’s install the htop package on this version of Linux and see what happens. First, open the Linux terminal and run the following command to update the APT package repository cache.

Step 1: Type the following command:

$ sudo apt update
update apt in Linux

update apt in Linux

Step 2: Now install the htop package using the following command.

$ sudo apt install htop
Installing htop in Linux

Installing htop in Linux

Step 3: After successfully installing the htop package, we can simply run and execute htop by following command:

using htop command

using htop command

Conclusion:

In this article we discussed the installation of Windows Subsystem for Linux (WSL) on Windows 10 streamlines which incorporation of a GNU/Linux environment without the need for virtual machines or dual boot configurations. WSL optimizes resource usage, making it ideal for users transitioning between operating systems or seeking Linux-like functionality on their Windows OS. The article guides users through the straightforward installation of WSL2, the latest version, offering native Linux usage on Windows 10. It emphasizes the simplicity of the process, allowing users to choose specific Linux distributions like Ubuntu during setup. Enabling the Virtual Machine platform using PowerShell ensures a smooth experience. The article also explores installing Linux packages through WSL, showcasing its compatibility and functionality. Following these steps empowers users to seamlessly integrate Linux capabilities into their Windows environment, enhancing their development workflow.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads