Installing PostgreSQL on Mac OS X for use with a local OMII Stack


Here is a simple set of instructions, which may prove useful when installing PostgreSQL on your Apple Mac for use with a local OMII Stack. At the time of writing, the latest version of PostgreSQL was 8.1.4. A prerequisite for this task is that you must have XTools installed so that you have access to the necessary compilation tools (this can be found on your Mac installation CD).

1. Download the PostgreSQL source release from http://www.postgresql.org/ftp/source/.

2. Unpack, build and install the binaries.

Note that PostgreSQL needs to know where it is going to be installed at build time.  In this case, the "/Users/justin/Work/postgres" directory is to be used.

tar -xzf postgresql-8.1.4.tar.gz

cd postgresql-8.1.4

./configure --prefix=/Users/justin/Work/postgres

make

make install

3. Change to the directory where your PostgreSQL is installed.  

4. Copy in the database_service.pl script from the omii-server directory.  You may well have unpacked this somewhere else entirely different from the given example.  This script is only used for stopping and starting the PostgreSQL server, so if you do not have access to it, or wish to use a different method, then that is fine.

5. Initialise and start your database:

cd /Users/justin/Work

postgres/bin/initdb -D postgres/data

cp ~/omii-server/extension/database_service.pl .

./database_service.pl start postgres

6. Create the databases (table spaces) and users required for the OMII Stack.  If you are not going to install the Integrated Services component, you will not require the omii database or omii_user user.

printf "CREATE USER auth_user WITH PASSWORD 'auth' CREATEDB NOCREATEUSER;\nCREATE DATABASE auth;\n\\q\n" | postgres/bin/psql template1

printf "CREATE USER mp_user WITH PASSWORD 'mp' CREATEDB NOCREATEUSER;\nCREATE DATABASE mp;\n\\q\n" | postgres/bin/psql template1

printf "CREATE USER omii_user WITH PASSWORD 'omii' CREATEDB NOCREATEUSER;\nCREATE DATABASE omii;\n\\q\n" | postgres/bin/psql template1

7. Turn on security on your PostgreSQL database and restart it.

./database_service.pl stop postgres

* edit postgres/data/pg_hba.conf and turn the 'trust' fields to 'md5'

./database_service.pl start postgres

Following these instructions will effectively have carried out steps 1 (install WS database), 3 (install Software Component Services database) and optionally 5 (install Integrated Services database) of the OMII Stack installation.  Use the Stack installer as normal to complete the installation.

Related Topics