From 3400e9b9d10107fa210df3d64b32fae25fdf9bbd Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Mon, 23 Apr 2012 10:00:19 +0100 Subject: Add step-by-step instructions for creating the database. --- notes/INSTALL.pod | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) (limited to 'notes') diff --git a/notes/INSTALL.pod b/notes/INSTALL.pod index 087deebc5..e13178601 100644 --- a/notes/INSTALL.pod +++ b/notes/INSTALL.pod @@ -88,18 +88,68 @@ geolocation services. =head2 Creating the database -The default settings file assumes the database is called fms and the user the same. +The default settings file (C) assumes the database is called fms and the user the same. You can change these if you like. +If you wish to create this new database and database user with +password authentication, the following steps may help. First, create +the fms user: + $ sudo -u postgres createuser fms + Shall the new role be a superuser? (y/n) n + Shall the new role be allowed to create databases? (y/n) n + Shall the new role be allowed to create more new roles? (y/n) n +Then create the fms database: + + $ sudo -u postgres createdb fms + +Set the password of the fms user, and change the owner of the fms database to be the fms user: + + $ sudo -u postgres psql + postgres=# ALTER USER fms WITH PASSWORD 'somepassword' + ALTER ROLE + postgres=# ALTER DATABASE fms OWNER to fms; + ALTER DATABASE + postgres=# \q + $ + +Then you need to configure PostgreSQL to allow password-based access +to the fms database as the user fms from using Unix-domain sockets. +Edit the file C and add as the +first line: + + local fms fms md5 + +You will then need to restart PostgreSQL with: + + $ sudo /etc/init.d/postgresql restart + +If you want to access the database from the command line, you can add +the following line to C<~/.pgpass>: + + localhost:*:fms:fms:somepassword + +Then you should be able to access the database with: + + $ psql -U fms fms =head2 Set up the database -Once you've created the database you can use the sql in C to create the required +Before creating the database schema, you will need to install the +PostgreSQL's SQL procedural language into the database: + + createlang -U fms plpgsql fms + +Now you can use the sql in C to create the required tables, triggers and stored procedures. You will also need to run -C which -populates the alert_types table. +C which populates the alert_types table. For +example, you might run: + + $ psql -U fms fms < db/schema.sql + ... + $ psql -U fms fms < db/alert_types.sql + ... =head2 Install Perl modules -- cgit v1.2.3