diff options
author | Mark Longair <mhl@pobox.com> | 2012-04-23 10:00:19 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2012-04-23 11:15:14 +0100 |
commit | 3400e9b9d10107fa210df3d64b32fae25fdf9bbd (patch) | |
tree | 1796e9876bcc6792ee9f0f46e06f3f192c7a7f32 | |
parent | a3bd45f927836d826cf0f6141bc63f3b1972eddd (diff) |
Add step-by-step instructions for creating the database.
-rw-r--r-- | notes/INSTALL.pod | 58 |
1 files changed, 54 insertions, 4 deletions
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<conf/general.yml>) 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</etc/postgresql/8.4/main/pg_hba.conf> 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<db/schema.sql> 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<db/schema.sql> to create the required tables, triggers and stored procedures. You will also need to run -C<db/alert_types.sql> which -populates the alert_types table. +C<db/alert_types.sql> 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 |