-
Notifications
You must be signed in to change notification settings - Fork 2
Installing LearnSQL locally
Christopher Innaco edited this page Nov 15, 2018
·
7 revisions
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
\datadirectory. - 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)
- Open an administrator Command Prompt or Powershell and navigate to the installation directory for PostgreSQL.
- Example installation directory:
C:\ Program Files\PostgreSQL\10\bin
- Example installation directory:
- Type,
psql -U postgres, wherepostgresis 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
learnsqldatabase 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
questionsdatabase 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>withclassdb_template - Change
...WITH OWNER = ClassDB;to...WITH OWNER = ClassDB_Admin;
- Replace
- The installer can be found here and will include
npm. Use the installer defaults.
- 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, thennpm installand finallynpm start.
- Open a web browser and navigate to
http://localhost:3000/. The LearnSQL homepage should be displayed.