Skip to content

Installing LearnSQL locally

Christopher Innaco edited this page Nov 15, 2018 · 7 revisions

LearnSQL Server Setup (localhost)

Author: Christopher Innaco

Step 1: Install PostgreSQL

The recommended interactive installer is distributed by EnterpriseDB and can be found here. LearnSQL is designed using versions 9.6 and 10.4, on a Windows 10 v1803 x86-64 environment, but may work with older versions and other platforms.

  • Run the installer as an administrator if not prompted.
  • The installation directory can be left as the default, although this may be changed with no side-effects.
  • Leave the default selections for components.
  • The default data directory can be left as the default, although if the installation directory was changed, append to it a child \data directory.
  • Set the password to: password.
  • Set the server to listen to port 5432, which is the default.
  • The locale can be left as the default.
  • When the files have completed installing, the installer can be closed without launching StackBuilder. (An unnecessary utility)

Step 2: Create the LearnSQL databases

  • Open an administrator Command Prompt or Powershell and navigate to the installation directory for PostgreSQL.
    • Example installation directory: C:\ Program Files\PostgreSQL\10\bin
  • Type, psql -U postgres, where postgres is the default user.
  • Enter the password defined during the installation process. Ignore errors regarding the incorrect rendering of 8-bit characters.
  • Now type the following statements to create the databases:
  • CREATE DATABASE learnsql;
  • CREATE DATABASE questions;
  • Switch to the learnsql database just created using \c learnsql.
  • Create the tables for this database using: \i 'C:/Users/<User>/…/LearnSQL/src/db/LearnSQL/addAllToDBAndServer.psql';
    • Note the use of forward slashes and single quotes.
  • Switch to the questions database using \c questions.
  • Create the tables for this database using: \i 'C:/Users/<User>/…/LearnSQL/src/db/Questions/createQuestionTables.sql';
  • Populate the tables using: \i 'C:/Users/<User>/…/LearnSQL/src/db/Questions/populate.sql';

Step 3: Install ClassDB

  • Follow the Full Installation process found on the ClassDB GitHub found here with the following substitutions.
    • Replace <databaseName> with classdb_template
    • Change ...WITH OWNER = ClassDB; to ...WITH OWNER = ClassDB_Admin;

Step 4: Install Node.js

  • The installer can be found here and will include npm. Use the installer defaults.

Step 5: Install the Web Server

  • Open a Command Prompt or Powershell as administrator
  • Navigate to the root of the LearnSQL directory and type npm install.
  • Next type npm start.
  • If errors regarding missing bindings for Sass are encountered, type: npm rebuild node-sass --force, then npm install and finally npm start.

Step 6: Launch the Web Server

  • Open a web browser and navigate to http://localhost:3000/. The LearnSQL homepage should be displayed.

Clone this wiki locally