Installing PrairieLearn on Linux or OS X

  1. Install the pre-requisites:

  2. Node.js

  3. npm
  4. MongoDB
  5. command-line git or GitHub Desktop

On OS X these can be installed with MacPorts or Homebrew. On Linux these should all be standard packages from the OS distrbution.

  1. Next clone the latest code:

    $ git clone https://github.com/PrairieLearn/PrairieLearn.git
    
  2. Install the backend libraries:

    $ cd PrairieLearn/backend
    $ npm install
    

Running PrairieLearn

  1. Run the database:
    $ mkdir ~/db     # or any other directory you want
    $ mongod --dbpath ~/db
    

This should end with a message like waiting for connections on port 27017 and will remain running in the foreground, so this terminal can't be used for anything else. Use Crtl-C to stop the database at any time.

  1. Run the server:
    $ cd PrairieLearn/backend
    $ node server
    

This should end with PrairieLearn server ready and will remain running in the foreground, so this terminal can't be used for anything else. Stopping or restarting the server can be done with Crtl-C.

  1. In a web-browswer go to http://localhost:3000

Updating PrairieLearn

  1. Stop the PrairieLearn server with Ctrl-C.

  2. Pull the latest version of PrairieLearn:

    $ cd PrairieLearn
    $ git pull
    
  3. Ensure the libraries are up-to-date with:

    $ cd PrairieLearn/backend
    $ npm update
    
  4. Restart the PrairieLearn server:

    $ cd PrairieLearn/backend
    $ node server
    

If this gives an error that it Cannot find module, then make sure the npm update command in the previous step was successful.