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

  • PHP
    1 year 7 months ago
    PHP 7.4
  • 1 year 7 months ago
    MariaDB 10.4.12
  • 1 year 7 months ago
    Dovecot 2.3.10
  • 1 year 7 months ago
    CentOS 6 revisions
  • 1 year 7 months ago
    Copy of the revision from Wed, 08/22/2018 - 13:39.