5 Build Dbmail
Now add a user and group called 'dbmail' which Dbmail will run as. The procedure to do this can vary from system to system so you may need to consult your system documentation.
# adduser dbmail
Dbmail comes with two scripts called build.sh and install-dbmail.sh which build and install dbmail respectively. Note however, both build.sh and install-dbmail.sh use certain programs during the installation process, and have the paths to these programs hardcoded in the scripts. For example, install-dbmail.sh uses chown and expects it's path to be /bin/chown. However, on some systems this is /usr/sbin/chown, so you may need to edit the scripts before using them. Also, install-build.sh uses bash2, if you are using bash1, you should download this patch, and save it to the dbmail source directory, and run
$ patch install-dbmail.sh < install-dbmail.sh.patch
If you are happy that these scripts are correct, you can build the binaries using the build.sh script. This will ask you a number of questions about your installation, such as where the include and lib directories for your database are.
$ bash build.sh
This is the dbmail build script
I will have to ask you some questions about your system
What database do you wish to use? Choices are (m)ysql and (p)ostgresql >
If you select MySQL, the following will be asked:
You have selected MySQL as database
The library directory for MySQL is now [/usr/local/lib/mysql/].
Enter new directory or press RETURN to keep this setting:
You can check this with the command mysql_config -libs
The include directory for MySQL is now [/usr/include/mysql/].
Enter new directory or press RETURN to keep this setting:
You can check this with the command mysql_config -cflags
The libraries are currently set to [-lmysqlclient -lcrypto].
Enter new libraries (preceed each by -l) or press RETURN to keep this setting:
Again, you can check this with mysql_config -libs
If you selected postgres as your database, the following questions will be asked:
You have selected PostgreSQL as database
The include directory for PostgreSQL is now [/usr/local/pgsql/include/].
Enter new directory or press RETURN to keep this setting:
Check this with pg_config --libdir
The library directory for PostgreSQL is now [/usr/local/pgsql/lib/].
Enter new directory or press RETURN to keep this setting:
Check this with pg_config --includedir
The libraries are currently set to [-lpq -lcrypto -lssl].
Enter new libraries (preceed each by -l) or press RETURN to keep this setting:
These *should* be fine...
Creating makefile..
Done. You can now make dbmail by running 'make clean all'.
Do you want this to be executed right now?
You can either continue to build dbmail now, or answer n, and run make clean all seperately.
y
[snip]
Make succesfull. Do you want to install the binaries and man pages?
If you ran build.sh as root, you can just answer yes, other wise, you will need to answer no and install it manually (see next section)
[Comment on this ]
[Table of Contents] [Top of section]
8 Create users in the dbmail system
Next you will need to create some users into the dbmail mailing sytem.
Currently this can be done in two ways. One way is using the dbmail-adduser
utility. The other way is doing it in the database itself. To do it using the dbmail-adduser utility do the following:
# dbmail-adduser a <username> <password> <clientid> <maxmail> [aliases]
clientid can be left 0 (this is if you want certain mailadministrators administer specific groups of mailusers). maxmail is the maximum number of bytes this user may have in his/her mailboxes. 0 is unlimited. aliases are a number of aliases for this user. @domain are domain aliases.
A user always needs to have at least one alias to receive mail.
example:
$ dbmail-adduser a john secret 0 25000000 john@dude.org john@dude.net @net.com
This will create a user john, with a password secret. It will set john's maillimit 25 Mb and all mail for john@dude.org, john@dude.net and @net.com will be sent to john.
The @net.com is a fallback alias. This means that all mail that cannot be delivered to an existing alias for a @net.com address will sent to john.
[Comment on this ]
10 Setting up the maintenance run
The dbmail daemons and the smtp injector itself will never actually delete mail from the database. The only program that will do this is the dbmail-maintanance program. This program will also check the integrity of the dbmail database and, if nescessary, fix it.
The dbmail-maintenance program will first delete all messages that are set for final deletion. After that it will set all messages that have the delete status set to status final deletion. This way dbmail always has a backup based upon the interval difference between maintenance jobs.
We recommend running the dbmail-maintenance program in a daily interval from cron:
0 3 * * * /usr/local/sbin/dbmail-maintenance -cfpd >> /dev/null 2>&1
[Comment on this ]