Running Linux on Windows 10


Linux on Windows 10

So you want to run Linux on your Windows 10, perhaps to learn something new or because you want to see what all the fuss is about.
Using the Microsoft Windows Store, you can easily install Linux on your Windows installation.

I’ve made this small guide as a reminder for myself and thought I’d share it publicly.
Perhaps someone else also appreciates it :)

To run a GNU/Linux environment directly on your Windows install, you will need WSL.
For more information about WSL, please read here.
To enable WSL, please use this PowerShell command (run as administrator):

1
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -All -NoRestart:$true

Running Linux requires you to have the Virtual Machine Platform feature installed.
Run this PowerShell cmdlet to install it:

1
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All -NoRestart:$true

After all this has been done you will need to restart your computer for the changes to go into effect.

1
Restart-Computer -Force -Asjob

Now you have WSL installed, but you’ll want to upgrade it to WSL2 for all reasons explained here.

You can use the Installer file provided by Microsoft, which you can find here

Now that you have the WSL2 installed, you need to set your machine to enable it by default.

1
wsl --set-default-version 2

Now that you’re done all the pre-requisite work, it’s time to get your favorite Linux distribution!

You can immediately trigger the Microsoft Store app to show you the available Linux distributions by clicking this link or if prefered simply search for Linux.

Find supported Linux Distros here:

Currently there’s a choice of

Linux on the Microsoft Store
Linux on the Microsoft Store

sudo apt update # Fetches the list of available updates
sudo apt upgrade # Installs some updates; does not remove packages
sudo apt full-upgrade # Installs updates; may also remove some packages, if needed
sudo apt autoremove # Removes any old packages that are no longer needed

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh

Download VSCode linux package
https://code.visualstudio.com/docs/?dv=linux64_deb

1
2
cd Downloads  
sudo apt install ./<downloadedFileName>

If you want to uninstall a WSL2 installation of Ubuntu, you can do this like a normal Windows 10 application.
For example to uninstall Ubuntu, right-click the Ubuntu shortcut in your Start menu and click Uninstall.