Commit 8c499c0b authored by Stephane Crozat's avatar Stephane Crozat
Browse files

Updating INSTALL

parent c82a4d2d
# Git
git clone https://gitlab.utc.fr/crozatst/apisub.git .
# PostgreSQL # PostgreSQL
## Bascics
apt-get install postgresql postgresql-contrib
## Add external data ## Add external data
add student.csv to data add student.csv to data
...@@ -23,9 +30,6 @@ chown apisub:apisub /usr/bin/apisub_ssh.sh ...@@ -23,9 +30,6 @@ chown apisub:apisub /usr/bin/apisub_ssh.sh
crontab -e -u postgres crontab -e -u postgres
crontab -e -u apisub crontab -e -u apisub
## pgcrypto module
apt install postgresql-contrib
## Test ## Test
psql -h localhost -U apisub -d apisub psql -h localhost -U apisub -d apisub
......
#!/bin/bash #!/bin/bash
SQL=`dirname $0` SH=`dirname $0`
SQL="$SH/../sql"
psql -c "DROP DATABASE IF EXISTS apisub" psql -c "DROP DATABASE IF EXISTS apisub"
psql -c "DROP USER IF EXISTS apisub" psql -c "DROP USER IF EXISTS apisub"
psql -c "CREATE USER apisub WITH ENCRYPTED PASSWORD '$1'" psql -c "CREATE USER apisub WITH ENCRYPTED PASSWORD '$1'"
...@@ -8,7 +9,7 @@ psql -d apisub -f "$SQL/apisub_functions.sql" ...@@ -8,7 +9,7 @@ psql -d apisub -f "$SQL/apisub_functions.sql"
psql -d apisub -f "$SQL/apisub_admin.sql" psql -d apisub -f "$SQL/apisub_admin.sql"
psql -d apisub -f "$SQL/apisub_tables.sql" psql -d apisub -f "$SQL/apisub_tables.sql"
psql -d apisub -f "$SQL/apisub_data.sql" psql -d apisub -f "$SQL/apisub_data.sql"
psql -d apisub -c "\copy student (utclogin, level) FROM '$SQL/../data/students.csv' WITH CSV DELIMITER ','" psql -d apisub -c "\copy student (utclogin, level) FROM '$SQL/../data/students.csv' WITH CSV DELIMITER ';'"
psql -d apisub -f "$SQL/apisub_views.sql" psql -d apisub -f "$SQL/apisub_views.sql"
psql -d apisub -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO apisub" psql -d apisub -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO apisub"
psql -d apisub -c 'CREATE EXTENSION IF NOT EXISTS "pgcrypto"' psql -d apisub -c 'CREATE EXTENSION IF NOT EXISTS "pgcrypto"'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment