The Larch image database uses PostgreSQL as its backend. In order to deploy Larch, PostgreSQL must be installed on some kind of high availability machine and configured as follows.
A user and group named 'postgres' should be created.
PostgreSQL must be installed. In the center, we use the BlastWave version which is trivial to install with something like
pkg-get install postgresql
Now we need to create a directory structure for the database. These database files will use about 28KB for an empty database and approximately 1/3 KB per image.
sudo mkdir -p /blah/blah/var/postgresql/liasdb
sudo chown postgres:postgres /blah/blah/var/postgresql/liasdb
sudo su postgres -c '/path/to/postgresql/install/bin/initdb -D /blah/blah/var/postgresql/liasdb'
PostgreSQL needs to be configured to start up on reboot with a start scripts something like this.
#! /bin/sh
/path/to/postgresql/install/bin/postgres -D /blah/blah/var/postgresql/liasdb &
Create a database for the Larch data.
sudo su postgres -c '/path/to/postgresql/install/bin/createdb LarchDB'
Log into PostgreSQL
su - postgres
/path/to/postgresql/install/bin/psql LarchDB postgres
Execute the Larch SQL commands included in the Larch distribution to initialize the new database.
\i _all.sql
Next we must configure PostgreSQL to accept network connections. First we must modify the PostgreSQL configuration file, usually called
postgresql.conf. Look for the line
listen_addresses="localhost"
and change to
listen_addresses="*"
This allows connections from all sites but we configure host authentication next so we are not open to the entire world.
The PostgreSQL client configuration file is usually called
pg_hba.conf and we must add a line to allow connections from our client machines. This would be something like this
host all all 129.21.0.0 255.255.0.0 trust
which allows connections from any ip address at RIT. This is overly open but, during development, we may be connecting from several different machines on several different subnets so I am leaving it like this for now.
--
BillHoagland - 10 Oct 2007