Post

Setup Windows Subsystem for Linux (WSL)

Setup Windows Subsystem for Linux (WSL)

Main OS

  • Windows 11
  • Windows 10

Hardware virtualization

  • It should be enabled (check on Task Manager -> Performance -> Virtualization: Enabled)
  • If it is not, I suggest enabling it on BIOS (on your CPU options enable Intel VT-x or AMD-V)
  • Not sure if this is mandatory, but I always do this to ensure I can create standard virtual machines (with Virtualbox for example) it might have some performance impact on your WSL2 setup, just in case, enable it if you can

Turn Windows features on or off

Go to windows feature and enable both:

  • Virtual Machine Platform
  • Windows Subsystem for Linux

Restart machine

Linux folder will appear on file explorer

Install / Update WSL

  • Using Command Prompt (CMD) run the following several times until the latest version is installed
    1
    
    wsl --update
    

Check available Linux distros

1
wsl --list --online

Choose and install Linux distro

1
wsl --install -d Ubuntu-22.04
  • Define UNIX username
  • Define password

Uninstall distribution

  • If you eventually need to uninstall a Linux distribution from WSL, go to CMD
  • Get the distribution name
    1
    
    wsl --list
    
  • Unregister the distribution, BE CAREFUL, everything will be deleted, backup your data if needed
    1
    
    wsl --unregister Ubuntu-22.04
    
  • Then go to “Add or remove programs”, search for the distribution name and uninstall it

Install terminal

From Microsoft Store install the official Terminal app by Microsoft Corporation, if you do not have it yet

Default terminal

Make Linux distro the default terminal on Terminal app settings

Update and Upgrade Linux distro

1
2
sudo apt update
sudo apt upgrade

Tip to open Windows file explorer

  • From Linux terminal, run the following command to open Windows file explorer in the current Linux directory
  • Useful to transfer files etc.
    1
    
    explorer.exe .
    
This post is licensed under CC BY 4.0 by the author.