Skip to content

Instantly share code, notes, and snippets.

@aaronfrey
Last active November 5, 2020 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronfrey/68897a75bbe036e03d89d04986343e85 to your computer and use it in GitHub Desktop.
Save aaronfrey/68897a75bbe036e03d89d04986343e85 to your computer and use it in GitHub Desktop.
Set up WSL2 on Windows 10

Set up WSL2 on Windows 10

Benefits

  • Natively run Linux commands
  • Run Docker using Linux so Virtualbox is still able to run on Windows
    • Docker for Windows now has an option to use WSL2 in settings

Enable WSL2

  1. Press Windows key and start typing Turn Windows features on or off. Select this and then enable the following features:
    • Virtual Machine Platform
    • Windows Subsystem for Linux
  2. Restart Windows
  3. Download and install the latest WSL2 Linux kernel update package for x64 machines
  4. Set WSL 2 as the default WSL version. Open Powershell and run the folowing:
wsl --set-default-version 2
  1. Install Ubuntu 18.04 LTS from the Microsoft store
  2. Launch the Ubuntu distribution and create a user account and password.

Install Windows Terminal and Integrate Cmder

Install Cmder

  • Download the latest full release of Cmder.
  • Unzip the release inside the following directory:
C:\Users\<User>\AppData\Roaming\Cmder
  • Add the following user environment variables:
CMDER_ROOT
C:\Users\<User>\AppData\Roaming\Cmder

ConEmuDir
C:\Users\<User>\AppData\Roaming\Cmder\vendor\conemu-maximus5
  • Open Cmder and navigate to Settings > Environment. Add the following line to the existing content:
chcp utf8

Install Windows Terminal

Configure Windows Terminal to integrate Cmder and set it as the default

  • Open PowerShell and generate a guid by running the following command:
New-Guid
  • Open Windows Terminal Settings and paste the following inside the list array, replacing guid with the unique one generated previously:
{
  "guid": "{6d953325-a939-475d-a151-940cbd0302fb}",
  "name": "Cmder",
  "commandline": "cmd.exe /k %CMDER_ROOT%\\vendor\\init.bat",
  "startingDirectory": "%USERPROFILE%",
  "icon": "%CMDER_ROOT%\\icons\\cmder.ico",
  "background": "#2e3436",
  "padding": "15",
  "fontFace": "Cascadia Code",
  "fontSize": 10
}
  • Replace the defaultProfile property with the guid value previously generated. This will start Windows Terminal using Cmder by default.
"defaultProfile": "{6d953325-a939-475d-a151-940cbd0302fb}",

Install Visual Studio Code extensions

  • Install the Remote - WSL extension so folders in the WSL can be opened in Visual Studio Code.

FAQ

  1. Why is a process called Vmmem taking up a lot of memory on my local machine?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment