Theo's Guide to WSL

Disclaimer: I'm simply recalling the steps I took from memory so everything might not be perfect. At the end of all this there will be a references section to documentation that served useful to me during this first time setup of WSL. Also note that as I continue to extend my WSL "setup" if you want to call it that, I will expand on it in this doc.

Installing WSL

Simply run the command wsl --install and bam 💥 you have WSL installed along with the Ubuntu distro.

Once the installation has been completed you'll be prompted to create a user account and password. This has no effect on any of your Windows things. This created user account will have sudo privileges so in short it's an admin account... You can do anything with it if you use that sudo keyword.

Installing Git on WSL only

  1. Run the command sudo apt-get install git
  2. Setup your git config file by running the commands:
    • git config --global user.name "Theo"
    • git config --global user.email "theeoh@proton.me"
    • git config --global init.defaultBranch main
  3. Install Git Credential Manager for Windows
    • Still in Windows open an administrator command prompt and run SETX WSLENV %WSLENV%:GIT_EXEC_PATH/wp to update the WSLENV environment variable with some value Git requires
  4. Run git config --global credential.helper "/mnt/c/Program\ Files\ \(x86\)/Git\ Credential\ Manager/git-credential-manager.exe" to set GCM as the Git credential helper
  5. Run ssh-keygen -t ed25519 -C "theeoh@proton.me" to create an SSH key. There will be some setup afterwards but just enter through all this and leave as defaults
  6. For sanity run the following 2 commands:
    • eval "$(ssh-agent -s)"
    • ssh-add ~/.ssh/id_ed25519
  7. Finally add the SSH key to your SSH keys in your GitHub account. To easily get your SSH key run cd ~/.ssh and cat id_ed25519.pub then simply copy and paste into GitHub
  8. You can test your SSH setup's success by running ssh -T git@github.com... At first you might see a warning which asks you yes/no, just say yes and press enter then run the command again and if you see something like Hi theeoh-92! You've successfully authenticated, but GitHub does not provide shell access You've done it correctly

From what I can remember I think that is the last of the Git stuff. From here on out you should be good to go with version control and pushing to GitHub etc...

VS Code on Windows Setup

Simply install the WSL extension inside VS Code and you good 🍻

Installing Node.js

I personally installed Node.js through NVM (Node Version Manager) since it makes it real easy to swap between different versions.

  1. Install cURL by running the command sudo apt-get install curl. It is a tool used to download content from the internet using your terminal.
  2. Install nvm by running curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash. You can test it installed successfully by running the command command -v nvm and it should return 'nvm'.
  3. Install the stable LTS Node.js version by running the command nvm install --lts and both the latest versions of Node and NPM will install onto your WSL instance.

Documentation

  1. Installing WSL
  2. WSL-based Git related documentation:
  3. Installing NVM