Skip to content

Linux and WSL Setup

rom-30 edited this page Oct 12, 2023 · 9 revisions

⚠️ WSL is not officially supported by La Fosse Academy! we recommend following this setup instead


We recommend using Docker containers during futureproof - and beyond!
For more details on other options for local env setup for Linux, check out the Optional section below.


Dev Environment Setup: Linux / WSL

Linux
If you are on Linux machine (as opposed to running WSL in Windows), skip to Setting up your environment.
This guide is based on an Ubuntu 18.04 Bionic distro but can be adjusted to suit.

WSL on Windows 10
If you are running Windows 10, you have the option of accessing the Windows Subsystem Linux. There was a major update to WSL in May 2020 so make sure you know which one you are using / aiming to use whilst setting up, debugging and working in your environment. Be aware that since WSL 2 is (at time of writing) a very recent release, there may be a lot of guides that refer to the original WSL. If the article does not specify, it is likely to be referring to WSL 1. Check out the official comparison docs here. If you can't decide and you are starting from scratch, go for WSL 2.

NB: WSL2 requires a Windows 10 build of 19041 or higher

Enable WSL & get your Linux distro

The official guide is excellent and we recommend working through it as your primary source. When choosing your distro, Ubuntu is a solid choice and has lots of great documentation but if you prefer something else, go for it! The rest of this guide will be based on an Ubuntu install.


Setting up your environment

Essential:

Update your system

In your Linux terminal run: sudo apt-get update (this command may differ depending on your Linux distro)

Connect git to GitHub

  • Run: git --version to see if you have git installed.
  • If git is not installed, find your appropriate install command here or run: brew install git (see Install Homebrew below).
  • To configure it to connect to your GitHub account run:
    git config --global user.email “[email protected]
    git config --global user.name “yourGithubUsername”

Setup an SSH key (and add it to your GitHub account)

  • Run: ssh-keygen and follow the instructions. If it asks if you want to overwrite, say no.
  • If you get stuck in this process, this walk-through gives detailed info on each step.
  • Visit the GitHub SSH keys settings page in your browser and click ‘New SSH Key’
  • Give it a title (anything you want to indicate the machine this key is for) and paste in your key.

Setup Docker and VSCode Remote - Containers

Complete this practice repo using the accompanying walkthrough!

Get node locally and install a global package

Although we will use Docker for many things, we will also install node locally for some global use tools that we may use.

  • Download and install nodejs using the official installation guides
  • Confirm your node installation
    • In your terminal, run node -v
    • If you see a version number eg. v18.16.1 then your install was successful!
    • You should also get version numbers back for npm -v and npx -v
  • Install your first global node package
    • npm install -g laughs
    • ha - wait for a joke!

Optional

Installing packages

Your package manager will depend on the Linux distro you chose. In Ubuntu your installs will generally follow the pattern of: sudo apt-get install <package-name>. Often you will be searching for the 'binaries' of packages/apps. Check out this documentation for installing nodejs on Ubuntu and Debian distros.

Install Node Version Manager

nvm is a great tool that lets us switch between node versions. This can be extremely useful when working with others.

Install Homebrew

Homebrew is a popular package manager for Mac & Linux applications.

Clone this wiki locally