- Install JDK
sudo apt-get install openjdk-8-jdk
- Set $JAVA_HOME in PATH. For example open .bashrc from home folder and add these lines:
export JAVA_HOME=<path to java>
export PATH=$JAVA_HOME/bin:$PATH
- Install maven
sudo apt-get install maven
- Add this line to .bashrc aswell
export PATH=<maven path>:$PATH
- Install postgreSQL
sudo apt-get install postgresql postgresql-client
- Launch postgreSQL from terminal
sudo su - postgres -c 'psql'
- Run this commad in postgreSQL UI
CREATE DATABASE "Dlearn_db";
- Run this commad in postgreSQL UI
ALTER USER postgres WITH PASSWORD 'admin';
- Run this command from backend root. Use password
admin
psql -U postgres -W -h localhost -d "Dlearn_db" -f database/db.sql
- Add some data to the database
\connect Dlearn_db
INSERT INTO "Students" (username, pwd, gender, age) VALUES ('student', '$2a$16$pdcURh3hIwiiCvkiU8zwLOCfNR3h/R2WuCTonoRBRZHry7/4.m5Hm', 'Male', 18);
INSERT INTO "Teachers" (lastname, firstname, username, pwd) VALUES ('Test', 'Teacher', 'teacher', '$2a$16$pdcURh3hIwiiCvkiU8zwLOCfNR3h/R2WuCTonoRBRZHry7/4.m5Hm');
INSERT INTO "Researchers" (username, pwd) VALUES ('researcher', '$2a$16$pdcURh3hIwiiCvkiU8zwLOCfNR3h/R2WuCTonoRBRZHry7/4.m5Hm');
- Install maven dependencies
mvn clean install
- Create jar file
mvn jar:jar
- Run the jar file
java -jar target/dependency/webapp-runner.jar target/*.war
- Finally
Have fun!
😄