Real Drums Destiny Ball Interest Calculator Torch 4 You The day of Safe Sex Drums 4 fun


 Powered by Max Banner Ads 

Vpopmail e PostgreSQL

Segnalo qui di seguito un articolo per chi vuole usare Vpopmail con PostgreSQL al posto di MySQL. Questo articolo è presente anche sul mio blog personale

Questo documento vuole essere una integrazione alla guida presente su www.qmailrocks.org nella sezione riguardante l’installazione di vpopmail con supporto sql. In questo documento andremo a vedere come sia possibile interfacciare Postgresql con Vpopmail.

Livello: medio/avanzato

[tags]qmail,vpopmail,postgres,postgresql,qmailrocks,sql,mysql[/tags]

Installazione di Postgresql
Download di Postgresql e scompattazione del package.

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su – postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test

/usr/local/pgsql/bin/psql test

cd /usr/local/src/postgresql-x.x.x/contrib/start-scripts/

Copiare e rendere eseguibile lo script nella directory per le attivazioni dei servizi al boot.

Es:

FreeBSD:
cp freebsd /usr/local/etc/rc.d/postgresql.sh
chmod +x /usr/local/etc/rc.d/postgresql.sh

Linux Debian:
cp linux /etc/init.d/postgresql
cd /etc/init.d
chmod +x postgres
update-rc.d -f postgres defaults

Installazione di Vpopmail con supporto PostgreSQL

bash-2.05b# mkdir ~vpopmail/etc
bash-2.05b# chown vpopmail:vchkpw ~vpopmail/etc
bash-2.05b# echo “localhost|0|username|password|vpopmail” > ~vpopmail/etc/vpopmail.pgsql

E’ possibile sostituire la username e password con i valori che si vuole.

bash-2.05b# chown vpopmail:vchkpw ~vpopmail/etc/vpopmail.pgsql
bash-2.05b# chmod 640 ~vpopmail/etc/vpopmail.pgsql
bash-2.05b# /usr/local/pgsql/bin/createdb vpopmail
bash-2.05b# /usr/local/pgsql/bin/createdb vpopmail -U postgres
CREATE DATABASE

bash-2.05b# /usr/local/pgsql/bin/createuser scotty -a -P -U postgres
Enter password for new user: (insert password)
Enter it again: (reinsert password)
Shall the new user be allowed to create databases? (y/n) y
CREATE USER

cd /downloads/qmailrocks

tar zxvf vpopmail-5.4.13.tar.gz

cd vpopmail-5.4.13

./configure –enable-logging=p –enable-auth-module=pgsql –disable-passwd –enable-clear-passwd –disable-many-domains –enable-auth-logging –enable-sql-logging

make && make install-strip

Proviamo ora a creare un dominio di posta
bash-2.05b# /home/vpopmail/bin/vadddomain prova.out

e per vedere le tabelle create basterà
bash-2.05b# /usr/local/pgsql/bin/psql vpopmail -U postgres

Welcome to psql 8.0.8, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

vpopmail=#\d
List of relations
Schema | Name | Type | Owner
——–+————-+——-+———-
public | dir_control | table | postgres
public | lastauth | table | postgres
public | prova_out | table | postgres
(3 rows)

A questo punto ogni volta che andremo ad inserire una variazione su qualsiasi dominio, le registrazioni dei paramtri degli utenti saranno memorizzare all’interno del db vpopmail.

Possibili problemi
Caso BSD:
Se ci dovesse essere un errore sulle librerie:
/libexec/ld-elf.so.1: Shared object “libpq.so.4″ not found

inserire ldconfig_paths=”/usr/local/pgsql/lib” in rc.conf

Posted on agosto 14, 2007 by scotty

Filed under Database, Mail Server | | 4 Comments »



Leave a Reply