Run Linux on Windows Using WSL2 | Linux

2023/12/15

If you want to practice Linux commands but only have a Windows computer, we recommend installing Windows WSL2 to run a Linux system, so you can easily switch to Linux using Windows Terminal.

It is recommended to use WSL2 instead of WSL

For Windows WSL2, manual installation is recommended

Official Documentation
### Check the WSL version on your Windows system
wsl -l -v

Steps

1. Make sure virtualization (VT) is enabled or available on your computer

2. Enable the Windows Subsystem for Linux

  1. Open PowerShell as Administrator
  2. Configure
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. Restart your computer (required)

3. Enable Virtual Machine feature

  1. Open PowerShell as Administrator
  2. Configure
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

4. Download the Linux Kernel Update Package

WSL2 Linux kernel update package for x64 machines

5. Set WSL2 as the default version

  1. Open PowerShell as Administrator
  2. Set WSL 2 as your default version
wsl --set-default-version 2

6. Install your Linux distribution of choice

  1. Open the Microsoft Store and select your favorite Linux distribution.
  2. Choose the distribution you want
  3. Install it
  4. Click Open
  5. The first time you open it, some initial setup will be performed — please wait
  6. Set your Linux username
  7. Set your Linux user password
  8. Setup is complete