How to Install WSL2 on Windows 10/11 Operating System

How to Install WSL2 on Windows 10/11 Operating System

Introduction

The Windows Subsystem for Linux (WSL) enables users to actively run a Linux environment directly on Windows without the need for a virtual machine or dual-boot setup. WSL natively uses the resources of the main operating system and runs faster requiring less space. In this guide, you will learn

  • What is WSL2

  • Features of WSL2

  • Installing WSL2 on Windows 10/11

Requirement

  • You need to have a Windows 10 version 2004(Build 19041) and higher or Windows 11

  • Have a virtual machine platform on Windows that provides virtualization capabilities

What is WSL2

Windows Subsystem for Linux 2(WSL2) is an updated version of the Windows Subsystem for Linux 1(WSL1), introduced by Microsoft in May 2019. WSL2 builds on the work done with WSL1. Rather than using a translation layer between Linux and Windows, it uses virtualization technology to allow you to run lightweight virtual machines directly on Windows 10.

Features

  1. System Call Compatibility: WSL 2 includes its own Linux kernel with full system call compatibility. It integrates fully with Docker and other applications.

  2. Virtualization Technology: It uses the hyper-v to create virtual machines that can run on your operating system.

  3. File I/O performance: WSL2 offers faster file system performance, especially for tasks involving intensive file I/O operations due to its full Linux kernel implementation, providing near-native Linux performance.

  4. Linux Kernel: Unlike WSL 1 which relied on a translation layer, WSL 2 includes a complete Linux kernel for better compatibility and performance

Installation

Step 1: Go to your Windows search bar> Turn Windows features on or off >Open

Step 2: Enable WSL, Virtual Machine Platform, Windows Hypervisor Platform and click Ok

Step 3: Click Restart now to reboot your PC

Step 4: After rebooting your PC, Right Click on the Windows icon in your taskbar, click on the Windows PowerShell(Admin), and open it.

Step 5: Enter this command to install Ubuntu wsl --install -d ubuntu

Step 6: Enter this command to update WSL wsl --update

Step 7: Enter this command to set the WSL version to 2 wsl --set-default-version 2

After completing all the steps close the terminal. Open Windows search and search for Ubuntu. Right-click and run as administrator. Set a new UNIX username and password.

Conclusion

WSL2 is a great tool to access native Linux functionalities and installing it is an easy process. In this guide, you have learned about WSL2, its features, and the installation process.

I hope you enjoyed my article!!

Connect with me on LinkedIn and Twitter.