Qmail
From OpenBSD-Wiki
| Written for: OpenBSD Version ? |
Before installing qmail, you should have daemontools and ucspi-tcp installed.
Contents |
[edit] Installation
cd /usr/src wget http://cr.yp.to/software/qmail-1.03.tar.gz tar xpzf qmail-1.03.tar.gz cd qmail-1.03 mkdir /var/qmail groupadd -g 5000 nofiles groupadd -g 5001 qmail useradd -u 5000 -g nofiles -d /var/qmail/alias -s /sbin/nologin alias useradd -u 5001 -g nofiles -d /var/qmail -s /sbin/nologin qmaild useradd -u 5002 -g nofiles -d /var/qmail -s /sbin/nologin qmaill useradd -u 5003 -g nofiles -d /var/qmail -s /sbin/nologin qmailp useradd -u 5004 -g qmail -d /var/qmail -s /sbin/nologin qmailq useradd -u 5005 -g qmail -d /var/qmail -s /sbin/nologin qmailr useradd -u 5006 -g qmail -d /var/qmail -s /sbin/nologin qmails make make setup check
[edit] Configuration
With these lines you are adding qmail's path to /etc/man.conf so you can view and search the man pages, and create the whatis.db database for use with apropos, whatis, and man -k
echo ' _whatdb /var/qmail/man/whatis.db _default /var/qmail/man/' >> /etc/man.conf /usr/libexec/makewhatis
Configure qmail:
./config
Add some defaults aliases: (be sure to change "some_real_user@your-domain.example.com" with a real email address)
echo some_real_user@your-domain.example.com > /tmp/alias-email
cd /var/qmail/alias for x in .qmail-abuse .qmail-mailer-daemon .qmail-postmaster \ .qmail-root .qmail-hostmaster .qmail-webmaster ; do cat /tmp/alias-email > $x; done rm /tmp/alias-email
[edit] Start it with daemontools
Create /var/qmail/run and /var/qmail/log/run and set the right owner and permissions:
cd /var/qmail echo '#!/bin/sh exec 2>&1 exec env - PATH="/var/qmail/bin:$PATH" qmail-start ./Maildir/' > run mkdir log echo '#!/bin/sh exec setuidgid qmaill multilog t s500000 n25 ./main' > log/run chown qmaill log chmod 2700 log chmod 755 run log/run
You can test if qmail starts fine and should see a line like this in your console (stdout):
status: local 0/10 remote 0/20
Exit with "CTRL + c".
supervise .
Finally you can make a symbolic link in /service to start qmail automatically:
ln -s /var/qmail /service/qmail
[edit] Testing
You can check your log file and should see a line like this:
@4000000046745cfe03a86c9c status: local 0/10 remote 0/20
cat /service/qmail/log/main/current
Do a ps and look for the qmail daemons. There should be four of
them, all idle: qmail-send, running as qmails; qmail-lspawn, running
as root; qmail-rspawn, running as qmailr; and qmail-clean, running
as qmailq. You will also see multilog, running as qmaill; and supervise running as root. Here is an example:
qmaill 10519 0.0 0.2 240 336 ?? I 6:58PM 0:00.01 multilog t s500000 n25 ./main
root 8621 0.0 0.1 220 316 ?? I 1:31AM 0:00.00 supervise qmail
qmails 29811 0.0 0.2 480 488 ?? I 1:31AM 0:00.01 qmail-send
qmailq 31502 0.0 0.2 332 440 ?? I 1:31AM 0:00.01 qmail-clean
qmailr 32202 0.0 0.2 416 372 ?? I 1:31AM 0:00.00 qmail-rspawn
root 7673 0.0 0.2 252 360 ?? I 1:31AM 0:00.00 qmail-lspawn ./Maildir/
ps aux | grep qmail
[edit] Links
