PostgreSQL

Prerequisites

yum -y install perl-ExtUtils-Embed
yum -y install readline-devel

Installation
Create a user and group for PostgreSQL:

groupadd postgresql
useradd -g postgresql postgresql

Download the latest source:

cd /extra/src
wget http://ftp.postgresql.org/pub/source/v9.1.3/postgresql-9.1.3.tar.gz
tar zxf postgresql-9.1.3.tar.gz
cd postgresql-9.1.3

Configure it. For DAViCal:

./configure --prefix=/usr/local/postgresql --with-perl --with-openssl

Build and install it:

make
make install

Create the data directory:

mkdir -p /usr/local/postgresql/data
chown postgresql /usr/local/postgresql/data

Set up default DAViCal databases:

su - postgresql
/usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data
exit

Set up for local access by editing /usr/local/postgresql/data/pg_ident.conf and adding:

        root    root    postgres

Edit /usr/local/postgresql/data/pg_hba.conf and add to the bottom:

local   davical    davical_app   trust
local   davical    davical_dba   trust

Automatic startup
We're going to use daemontools.
If you haven't already, install daemontools.

Create a directory for the MySQL service:

mkdir -m 1755 /var/service/postgresql
cd /var/service/postgresql

Create the /var/service/postgresql/run script, making sure to change the servername:

#!/bin/sh

USER=postgresql
POSTMASTER=/usr/local/postgresql/bin/postmaster
DATADIR=/usr/local/postgresql/data

exec 2>&1
setuidgid $USER $POSTMASTER \
   -D $DATADIR

Make the script executable:

chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/postgresql /service/postgresql

Confirm that the service is running:

svstat /service/postgresql /service/postgresql/log

Recent Updates

  • 2 years 2 days ago
  • 2 years 2 days ago
  • 2 years 4 days ago
    php 8.x
  • 2 years 6 days ago
    10.6.7
  • 2 years 1 week ago
    Drop Centos 5/6 stuff