Configure Horde with PostgreSQL

From Kolab wiki

Jump to: navigation, search


Setup PostgreSQL

Your distribution might configure PostgreSQL for you or have better tools for configuring it other than by hand. Refer to PostgreSQL documentation. A general hint: For trouble with PostgreSQL, you perhaps need to delete the file /kolab/var/postgresql/db/postmaster.pid, if the server crashed and the database was not shut down properly. This also helps with informative error messages: pg_initdb -D "/kolab/var/postgresql/db"


In the following I assume that you use a postgresql server running for and within kolab only, installed via openpkg. First thing I did was:

su kolab-r # if not already working as kolab-r\
/kolab/bin/pg_initdb -D "/kolab/var/postgresql/db"
su kolab-r
/kolab/bin/pg_ctl start -D "/kolab/var/postgresql/db"
    you also can use
/kolab/etc/rc postgresql start

If you use the postgreql included in your disribution, you will have to use another user and another paths. Additionally you might have to change access rights: for kolab rpms in /kolab/var/postgresql/db/pg_hba.conf

 e.g. host    hordeDBName    hordeDBUserName    127.0.0.1   255.255.255.255 trust
 Trust allows all users on local machine login through tcp without specifiing password. Refer to official documentation for other autentification types.

Configure PostgreSQL

cd /kolab/var/kolab/www/horde/scripts/sql

edit create.pgsql.sql uncomment the ALTER USER line and change the password
su kolab-r # this will be most likely postgres for non-kolab packages /kolab/bin/psql -d template1 -f create.pgsql.sql /kolab/bin/psql -d horde -f horde_datatree.sql /kolab/bin/psql -d horde -f horde_prefs.sql /kolab/bin/psql -d horde -f horde_users.sql

Configure Horde

Firstly you need to install the distribution default configuration files, present in the config subdirectory within each Horde application including the base Horde library itself: (Note: this is a configuration step which applies to all databases not only to postgresql)

for a in . mnemo nag turba imp ingo kronolith passwd; do
  cd /kolab/var/kolab/www/horde/$a/config;
  for f in *.dist; do
    cp $f `basename $f .dist`;
  done;
done
#and then set the correct file permissions:
cd /kolab/var/kolab/www chown -R kolab-n:kolab-n horde chmod -R o-rwx horde

Then configure postgresql as database in /kolab/var/kolab/www/horde/config/conf.php
Remember to adjust database-user and password!

$conf['sql']['phptype'] = 'pgsql';
$conf['sql']['persistent'] = false;
$conf['sql']['protocol'] = 'tcp'; /* refer to above comment about unix domain socket */
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'hordeDBUserName';
$conf['sql']['password'] = 'somepassword';
$conf['sql']['database'] = 'horde';
$conf['sql']['charset'] = 'iso-8859-1';
Personal tools