Skip to content

Instantly share code, notes, and snippets.

@aeweda
Created September 21, 2021 11:31
Show Gist options
  • Save aeweda/989c24d21c5ae9b499fb7629245807ce to your computer and use it in GitHub Desktop.
Save aeweda/989c24d21c5ae9b499fb7629245807ce to your computer and use it in GitHub Desktop.
Install & Configure WSL

First of all confirm that you have windows Version 1903 or higher, with Build 18362 or higher. & That virtualization technology is enabled from BIOS/UEFI

Install WSL

  1. Run the following commands in a powershell window as admin & Reboot your pc
$ dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
$ dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  1. Install the wsl package on windows Download
  2. Run the following command in powershell window as admin
$ wsl --set-default-version 2
  1. Open the microsoft store and install ubuntu (Recommended distro unless you know what you're doing you can go with something else)
  2. Once ubuntu is installed launch it up from your start menu, it should prompt you for a username/password pick any, doesn't have to be the same as windows

Configure a Terminal

  • Launching WSL from the ubuntu.exe is fine and all but very messy we need something better for day to day activities
  • Open microsoft store and download "Windows Terminal"
  • Open up windows terminal and go to the settings
  • Select the default profile as ubuntu
  • Click on the ubuntu profile on the bottom left and change starting directory to \\wsl$\Ubuntu\home\<the-username-you-picked-for-ubuntu>

Minor Caveats and Problems that may arise

  • once you launch your wsl instance try doing a sudo apt update && sudo apt upgrade -y
  • if you run into a network problem then do the following steps
    • create a file called wsl.conf in /etc/ with echo '' > /etc/wsl.conf or touch /etc/wsl.conf
    • add the following data inside of it [network] generateResolvConf = false
    • and run the following command echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment