Install WSL and Ubunto distro on Windows 10

Notes activating Windows Subsystem for Linux (WSL) and installing Ubuntu (ver 20.04 LTS) on my Windows 10 Home (21H1) PC.

Modified from

Note also includes instructions to install Homebrew

Enable WSL

  1. Open PowerShell as Administrator
  2. Run at command line
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Enable Virtual Machine platform

  1. Assuming system meets requirements for WSL2, proceed to enable virtual machine platform. Run at command line
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  2. Download wsl_update_x64.msi.
  3. Restart PC to complete WSL install and update WSL2.

Install update package

  1. Run wsl_update_x64.msi, the Linux kernel package. Follow instructions as presented.

Set WSL 2 as default version

  1. Open Powershell as Administrator. Run
    wsl --set-default-version 2

Get Linux distro from Microsoft Store.

  1. I installed Ubuntu 20.04 LTS. As of 26 July 2021, Direct url https://www.microsoft.com/store/apps/9n6svws3rx71
  2. After installation, launch UBUNTU (e.g., start menu) to finish Linux setup.

Update Linux

#download package information
sudo apt update
#install packages from sources listed in /etc/apt/sources.list.
sudo apt upgrade

Install Homebrew

https://brew.sh/

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

test install

test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile

Update gcc

brew install gcc