=====DBMail 3.x.x===== Below you will find the necessary steps to compile DBMail-3.0.1 from source for use with a PostgreSQL database and support for SIEVE. These steps work on OpenBSD 5.0 AMD64. ====Compilation==== Prepare an OpenBSD installation with the compiler set installed. \\ Install the required packages: pkg_add -i postgresql-server glib2 gmime mhash libeventextra gmake ===libSieve=== Download [[http://libsieve.sourceforge.net/|libSieve]] and extract. (Tested with 2.2.7.) tar xzvf libsieve-2.2.7.tar.gz Compile libsieve: cd libsieve-2.2.7/src ./configure make Execute a make install and redirect the output to installresult to be able to find out where the libsieve files are placed: make install > installresult Place the following files in a .tar.gz archive, based on a make install output from a libsieve 2.2.7 compilation. tar vcf libsieve-2.2.7-openbsd-5.0-amd64.tar /usr/local/lib/libsieve* tar vuf libsieve-2.2.7-openbsd-5.0-amd64.tar /usr/local/lib/pkgconfig/libsieve.pc tar vuf libsieve-2.2.7-openbsd-5.0-amd64.tar /usr/local/include/sieve2*.h gzip libsieve-2.2.7-openbsd-5.0-amd64.tar The archive can be extracted on the server with: tar xzvpf libsieve-2.2.7-openbsd-5.0-amd64.tar.gz -C / ===libzdb=== Download [[http://www.tildeslash.com/libzdb/|libzdb]] and extract. (Tested with 2.10.) tar xzvf libzdb-2.10.tar.gz Compile libzdb without support for mysql, sqlite and with the recommended protect non-API objects: cd libzdb-2.10 ./configure --without-mysql --without-sqlite --enable-protected gmake Execute a make install and redirect the output to installresult to be able to find out where the libzdb files are placed: gmake install > installresult Place the following files in a .tar.gz archive, based on a make install output from a libzdb 2.10 compilation. tar vcf libzdb-2.10-openbsd-5.0-amd64-bin.tar /usr/local/lib/libzdb* tar vuf libzdb-2.10-openbsd-5.0-amd64-bin.tar /usr/local/include/zdb gzip libzdb-2.10-openbsd-5.0-amd64-bin.tar The archive can be extracted on the server with: tar xzvpf libzdb-2.10-openbsd-5.0-amd64-bin.tar.gz -C / ===DBMail 3.0.1=== Download the [[http://git.dbmail.eu/paul/dbmail/|DBMail]] source .tar.gz and extract. tar xzvf dbmail-3.0.1.tar.gz Change directory to the dbmail-3.0.1 directory: # cd dbmail-3.0.1 Before you can compile DBMail 3.0.1 on OpenBSD 5.0 you have to apply three small patches: \\ server.c.patch: --- src/server.c.original Tue Feb 28 15:40:28 2012 +++ src/server.c Fri Mar 2 19:54:19 2012 @@ -474,7 +474,7 @@ int serr=errno; switch(serr) { case ECONNABORTED: - case EPROTO: + case EPROTONOSUPPORT: case EINTR: TRACE(TRACE_DEBUG, "%s", strerror(serr)); break; dbmail.h.in.patch: --- src/dbmail.h.in.orig Sun Aug 14 10:09:59 2011 +++ src/dbmail.h.in Mon Oct 17 19:23:51 2011 @@ -23,6 +23,8 @@ * header file for a general configuration */ +#include + #ifndef _DBMAIL_H #define _DBMAIL_H @@ -32,7 +34,7 @@ #define __EXTENSIONS__ /* solaris */ -#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__SUNPRO_C) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__SUNPRO_C) #define _XOPEN_SOURCE @@ -66,7 +68,6 @@ #include #include #include -#include #include #include #include configure.patch: --- configure.original Tue Feb 28 15:40:28 2012 +++ configure Fri Mar 2 19:47:52 2012 @@ -4925,7 +4925,7 @@ cat >>confdefs.h <<_ACEOF #define HAVE_EVENT_H 1 _ACEOF - EVENTLIB="-levent" + EVENTLIB="-levent -leventextra" else EVENTLIB="failed" fi Copy the above lines to each .patch file, or just download {{:os:openbsd:dbmail-3.0.1-openbsd-patches.tar.gz|}} and extract (in the parent directory of the dbmail-3.0.1 directory) with: tar xzvf dbmail-3.0.1-openbsd-patches.tar.gz To apply the patches, make sure your working directory is dbmail-3.0.1 and the patches have been extracted to the parent directory of the dbmail-3.0.1 directory and apply with: patch -p0 < ../dbmail.h.in.patch patch -p0 < ../server.c.patch patch -p0 < ../configure.patch Compile dbmail with libsieve and libzdb: ./configure --with-sieve=/usr/local --with-zdb=/usr/local CPPFLAGS=-I/usr/local/include make Execute a make install and redirect the output to installresult to be able to find out where the dbmail files are placed: make install > installresult Place the following files in a .tar.gz archive, based on a make install output from a dbmail 3.0.1 compilation. tar vcf dbmail-3.0.1-openbsd-5.0-adm64.tar /usr/local/lib/dbmail tar vuf dbmail-3.0.1-openbsd-5.0-adm64.tar /usr/local/sbin/dbmail-* cp dbmail.conf /etc/dbmail.conf.sample tar vuf dbmail-3.0.1-openbsd-5.0-adm64.tar /etc/dbmail.conf.sample gzip dbmail-3.0.1-openbsd-5.0-adm64.tar Don't forget the line to copy the dbmail.conf to /etc/dbmail.conf.sample! The archive can be extracted on the server with: tar xzvpf dbmail-3.0.1-openbsd-5.0-adm64.tar.gz -C / =====DBMail 2.x.x====== [[http://www.dbmail.org/|DBMail]] "fast and scalable sql based mail services". At this moment an OpenBSD package isn't available for DBMail. \\ See also:[[http://www.helgrim.com/dbmaildocs/installation.html|Helgrim.com - DBMail installation guide]] and [[http://marc.info/?l=openbsd-misc&m=112577563201458&w=2|DBMail on OpenBSD]] for an openbsd-misc mailinglist post from 2005 about DBMail. \\ Below you will find the necessary steps to compile DBMail2 from source for use with a PostgreSQL database. These steps work on OpenBSD 4.9 and lower. ====Compilation===== Prepare an OpenBSD installation with the compiler set installed. \\ Install the following packages: \\ For pg_control: pkg_add -i postgresql-server For dbmail dependancies: pkg_add -i glib2 pkg_add -i gmime To prevent the [[http://www.dbmail.org/dokuwiki/doku.php?id=upgrading_to_2.1&s=iconv|error message]] when compiling dbmail: ln -s /usr/local/include/iconv.h /usr/include/iconv.h Extract dbmail: \\ tar xvzf dbmail-2.2.13.tar.gz Compile dbmail: \\ cd ./dbmail-2.2.13 ./configure --with-pgsql make Execute a make install and redirect the output to makeinstall to be able to find out where the dbmail files are placed: make install > makeinstall After this dbmail.conf isn't in the right spot yet, correct this with the following: cp dbmail.conf /etc/dbmail.conf.sample After installation dbmail.conf.sample should be renamed to dbmail.conf if /etc/dbmail.conf doesn't exist yet. Place the following files in a .tar.gz archive, based on a make install output from a dbmail 2.2.13 compilation. \\ tar vcf /root/dbmail-2.2.13-bin.tar /usr/local/lib/dbmail tar vuf /root/dbmail-2.2.13-bin.tar /usr/local/sbin/dbmail* tar vuf /root/dbmail-2.2.13-bin.tar /usr/local/share/man tar vuf /root/dbmail-2.2.13-bin.tar /etc/dbmail.conf.sample gzip /root/dbmail-2.2.13-bin.tar The archive can be extracted on the server with: tar xvzpf dbmail-2.2.13-bin.tar.gz -C / =====DBMail Configuration===== ===On the PostgreSQL db server=== Create the user dbmail: $ createuser -U postgres dbmail Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) n Password: CREATE ROLE Set a password for the user dbmail: $ psql -U postgres Password for user postgres: Welcome to psql 8.2.6, 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 postgres=# alter user dbmail with password 'password'; ALTER ROLE postgres=# \q Create the dbmail database (PostgreSQL < 8.4.4): $ createdb -E utf8 -U postgres -O dbmail dbmail Password: CREATE DATABASE Create the dbmail database (PostgreSQL >= 8.4.4): $ createdb -E utf8 -U postgres -O dbmail dbmail -T template0 Password: CREATE DATABASE Copy the ./sql/postgresql/create_tables.pgsql from dbmail-x.x.x.tar.gz to the database server and execute this script on the dbmail database: $ psql -U dbmail dbmail < create_tables.pgsql Password for user dbmail: BEGIN CREATE SEQUENCE [...] CREATE TABLE CREATE INDEX COMMIT $ ===On the server where the dbmail executables should run=== Copy /etc/dbmail.conf.sample to /etc/dbmail.conf and remove any other/world permissions: cp /etc/dbmail.conf.sample /etc/dbmail.conf chmod o-rwx /etc/dbmail.conf ==DBMail 2.x.x== Open /etc/dbmail.conf in an editor and change the following lines to reflect your environment: driver = pgsql authdriver = sql host = 10.0.0.200 user = dbmail pass = password db = dbmail Open /etc/rc.local and add the following above the "echo '.'" line: if [ -x /usr/local/sbin/dbmail-imapd ]; then echo -n ' dbmail-imap' /usr/local/sbin/dbmail-imapd > /dev/null fi ==DBMail 3.x.x== Open /etc/dbmail.conf in an editor and change the following lines to reflect your environment: driver = postgresql authdriver = sql host = 10.0.0.200 user = dbmail pass = password db = dbmail effective_user = _dbmail effective_group = _dbmail Open /etc/rc.local and add the following above the "echo '.'" line: if [ -x /usr/local/sbin/dbmail-imapd ]; then echo -n ' dbmail-imap' rm -f /var/run/dbmail-imapd.pid > /dev/null touch /var/run/dbmail-imapd.pid > /dev/null chown _dbmail:_dbmail /var/run/dbmail-imapd.pid > /dev/null /usr/local/sbin/dbmail-imapd > /dev/null fi Create the _dbmail group and user: groupadd _dbmail useradd -d /var/empty -L daemon -s /sbin/nologin -g _dbmail _dbmail Create dbmail users with: dbmail-users -a username -W -s address@domain.com