Setup of Your Laptop Dev Environment (Canvas assignment)

Completion of the following setup tasks are all to be submitted in a single Canvas assignment. Keep a log of any errors or difficulties you encounter, and include those with your submission.

Windows with the WSL

This doc assumes you are using the WSL in the way described in the 201 prework, or in this guide.

Create Directory

Create a directory $wr/codefellows/301/ to hold your work for this course, by running the command:

mkdir -p $wr/codefellows/301

Install Heroku CLI

Go to this link and follow the standalone install instructions (NOT the Windows instructions, NOT the Ubuntu instructions). This will install the Heroku CLI on your Ubuntu FS. This allows the CLI to run in a POSIX environment, fixing the Heroku:pg push issue that exists on Windows.

Verify Installation

From the command line, type heroku --version to verify that your Heroku installation was successful. Skip taking a screenshot (for your canvas assignment) until you can verify PostgreSQL as well.

You are now done with the Heroku CLI! Next you will be installing PostgreSQL 10!

Install Nodemon

In Code 301, Nodemon is a tool that is used to restart the server when changes are made in your server code.

In your terminal, run npm i -g nodemon. Run the command nodemon –version to confirm proper installation of Nodemon.

Install PostgreSQL using WSL

This doc explains how to install PostgreSQL 10 for Windows WSL

We are installing this through the Ubuntu command line since we want this software to run in the Linux environment. You can check out the PostgreSQL Linux install docs here.

Install

  1. Open a terminal (the Ubuntu app) and then go to the root of the Ubuntu Subsystem by typing cd ~ .
  2. Run lsb_release -a and make note of the Codename listed.
  3. Type sudo nano ../../etc/apt/sources.list. This will open a file on Ubuntu using the Nano editor.
  4. At the bottom of this file, paste in the line deb http://apt.postgresql.org/pub/repos/apt/ CODENAME-pgdg main, replacing CODENAME with the word you noted in step 2.
  5. When that’s done, press ctrl + x together to close the file, press y when prompted to save your changes, and enter to finally close.
  6. Next, copy these 2 lines and paste them into your terminal:
      wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
      sudo apt-get update
    

    This will add postgresql 10 to your repositories so you can install the latest version of Postgresql.

  7. After the update is complete, enter in the line sudo apt-get install postgresql-10 and press y when prompted.
  8. To launch the postgres service, type sudo service postgresql start.

Postgres User Setup

Verifying Installation And Setting A Password

If Using PostgreSQL Version > 11 OR Having Postgres Issues

Suggestion

Since typing out sudo service postgresql start all the time can be tedious, and you’ll need to run this when you restart your computer, we recommend you set up an alias for this.

  1. Open a terminal and type cd ~, then type nano .profile. This will open your .profile which controls what your terminal does and looks like.
  2. Add this line next to any other aliases that you have:
    alias pgstart='sudo service postgresql start'
    

    This will allow you to type pgstart to start running the psql service. This is an example of a Quality of Life enhancement, something that makes your life easier and faster as a developer.

You can change pgstart to what ever you want, but just be careful you don’t overwrite something that postgres might use.

Final Steps

When you are finished installing the Heroku CLI and PostgreSQL, please move here to complete your Final Steps.