Step 6.5 of 7 - Linux Setup

--

This guide will walk you through the process of setting up your Linux PC for coursework at LearningFuze. The steps need to be completed in the order provided. There are some video clips, pictures, and commands in this guide, but be sure to read all instructions thoroughly so you don't accidentally skip a step.

Check System Requirements

First check to make sure that your computer meets these system requirements:

  • Computer* less than 4 years old (depending on how fast it is)
  • 64-bit Intel or AMD processor
  • 8GB RAM minimum, 16GB recommended
  • 16GB of free disk space minimum
  • A supported Linux distribution or derivation less than 2 releases old
    • Debian (Ubuntu, Mint, Pop_OS)
    • Redhat (RHEL, Fedora)

A laptop* is required for in-person LearningFuze courses.

Note: Arch (and Manjaro) or Gentoo distributions are not supported

Note: BSD (which aren't Linux) distributions are not supported

Be ready to use your command line

Due to variations in different Linux distributions, there is no guarantee that these instructions will work if you are running a heavily customized operating system. Our computer setup was only tested on the following distributions running the Gnome desktop environment and systemd:

  • Ubuntu 20.04+
  • Fedora 35+

It's assumed that if you are going to use a Linux distribution, that you understand how your operating system's package manager works and that you know what you're doing. Although the LearningFuze course curriculum does cover some shell and file system skills, it does not focus on Linux administration.

Go Ahead!

That said, the process is relatively straightforward and should work just fine on derivations of Ubuntu or Fedora that also use Gnome.

Install required packages

The following packages are required for either completing the setup process.

  • git
  • openssh-client
  • curl
  • nano

You can check for the existence of any of these with the command command.

command -v git
command -v ssh
command -v curl
command -v nano

If the command command outputs nothing for one of the above, then it's missing and needs to be installed.

To install these on an Ubuntu derivative, use the apt package manager.

sudo apt update
sudo apt install git openssh-client curl nano

To install these on a Fedora derivative, use the dnf package manager.

sudo dnf install git openssh-client curl nano

On other systems you might use yum or rpm to install these packages 🤷‍♀️.

Install Docker

At LearningFuze, we use Docker to create a professional-grade development sandbox on your computer. Docker must be running in the background to make this possible. This section of the guide walks you through the process of installing Docker on your computer.

Since Docker is based on Linux technology, installing it can be more straightforward than it is on macOS or Windows. The Docker team has created a convenience script that you can run to install it. The script needs to run some commands as root, so we include sudo when running it through sh.

curl -fsSL 'https://get.docker.com/' | sudo sh

Confirm that docker has been installed. Something like /usr/bin/docker should print.

command -v docker

By default, non-root users cannot use docker, so we're going to add your user account to the docker group.

sudo usermod -aG docker "$(whoami)"

Next we need to make sure that the Docker daemon starts with your system.

sudo systemctl enable docker

Now restart your computer, this will auto-start Docker and refresh your user account's group membership.

sudo reboot

Run our Setup Script

At LearningFuze, you'll be using a customized configuration of Microsoft's Visual Studio Code. If you already have Visual Studio Code installed, it shouldn't cause any conflicts, but you will be using our custom version for class.

The setup script requires that Docker is running. You can confirm the status of Docker by running the following command on the command line.

docker ps

You should not receive an error message. Instead, something like the following should print.

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Here is the command to execute our setup script. Paste it into your terminal and press Enter.

curl -fsSL 'https://lfz-static.s3.us-west-1.amazonaws.com/lfz-code/linux.sh' | sh

The setup script will do the following:

  • verify that you have the required packages installed
  • verify that you have Docker installed
  • pull the Docker image used by our development sandbox
  • download a standalone, customized Visual Studio Code editor
  • generate a dedicated SSH key for your computer to authenticate with GitHub
  • add a shortcut for lfz-code to your system's applications

⚠️ If the setup script fails

If the setup script fails, your terminal will show you an error message. Find the lfz-code.log file on your Desktop and send it to an instructor via Slack right away so we can figure out what went wrong and advise you on the next steps to take.

Add SSH Key to GitHub

Once the setup script has completed successfully, proceed with the following instructions.

When you ran the setup script, a unique key was generated specifically for your computer. Print the contents of the key with the following command.

cat ~/.ssh/github_rsa.pub

Your SSH public key for GitHub should print. This key was created during the setup script and will be used to authenticate your computer with GitHub so that you can freely download and upload your code.

Sign into your GitHub account and go to https://github.com/settings/keys. Click New SSH key on GitHub. Give the new key a name that will remind you which computer you pasted the key from. Copy-paste your key from your terminal output into GitHub and click Add SSH key. If given the option, choose Authentication Key as the Key type.

To confirm that your SSH key was properly added to GitHub, go back to the command line and paste in the following command, then press Enter. Because this may be the first time that you are connecting your computer to GitHub via SSH, you might receive a confirmation message asking you if you want to continue connecting. Type yes and press Enter. After that, you should receive a message confirming that you've successfully authenticated.

ssh git@github.com

Add your name and email address to Git

After your SSH key has been successfully uploaded to GitHub and you have verified that your PC authenticates successfully, update Git to remember your name and email address. This should be your full name and the email address you used to sign up with GitHub.

Enter the following commands into your terminal to set your name and email address, but use your own name and email address instead of the examples.

git config --global user.name "Joe King"
git config --global user.email "joe@email.org"

You can check for typos with the following command. You may see some other values print, but the most important things to check are your name and email address. You can fix typos by running the above commands again.

git config --global --list

Clone your solutions repository from GitHub

When you signed into the Learning Management System, a new repository was create for you on your GitHub account. If you visit your profile on GitHub and then go to the Repositories tab, you should see it.

The repository will be named xxxx-code-solutions where the xxxx is your cohort number. For example, if student was enrolled in our Web Dev Prep Class for October, 2020, their repository was named prep-1020-code-solutions. Your repository's name will be similar, but slightly different depending on which class you are enrolled in.

Note: If you cannot find your repository on GitHub, stop and notify an instructor via Slack.

To clone

In this step you are going to download a copy of this repository onto your computer.

  1. Be signed into your personal GitHub account at https://github.com
  2. Go to your Repositories page
  3. Find your code solutions repository and click on it
  4. Open the lfz-code app
  5. Click the blue icon in the bottom-left of the Visual Studio Code window and choose Clone Repository in Container Volume...
  6. When Visual Studio Code warns you about arbitrary code execution, click Got it.
  7. Back on your repository page, click the Code button and copy the SSH URL from your repository. Only the SSH URL will work.
  8. Paste the URL back into the box in Visual Studio Code and press Enter.
  9. Wait. The initial download might take a minute or two.
  10. When you see the message saying "Done. Press any key to close the terminal." press any key :)

Great! If you ran into problems, please contact an instructor via Slack. Otherwise, you have successfully cloned your repository!

Closing and reopening your solutions repository

This section of the guide shows you how to open your solutions back up after you have closed them. Visual Studio Code keeps a history of which repositories, files, and projects you have opened. You can see by following these steps.

  1. Close Visual Studio Code.
  2. Reopen lfz-code.
  3. Go to the File menu.
  4. Go to Open Recent...
  5. Choose your recently-closed code solutions repository.
  6. Wait a moment.

Nice! Your repository should open back up again. This time it should open much faster. Any time you want to return to your solutions repository, you can get to it via File > Open Recent....

Finish up! ➡️

Let's do a review!