Installation of qmail
1. Create the
qmail home directory:
# mkdir /var/qmail
2. Set up
the qmail
group and the
qmail users
before compiling the programs.
-
First add two new lines to /etc/group :
qmail:*:2107:
nofiles:*:2108:
where 2107 and 2108 are different from the other gids in /etc/group.
-
Next (using vipw) add six new lines to /etc/passwd,
something like
alias:*:7790:2108::/var/qmail/alias:/bin/true
qmaild:*:7791:2108::/var/qmail:/bin/true
qmaill:*:7792:2108::/var/qmail:/bin/true
qmailp:*:7793:2108::/var/qmail:/bin/true
qmailq:*:7794:2107::/var/qmail:/bin/true
qmailr:*:7795:2107::/var/qmail:/bin/true
qmails:*:7796:2107::/var/qmail:/bin/true
where 7790 through 7796 are _new_ uids, 2107 is the qmail gid, and 2108
is the nofiles gid. Make sure you use the nofiles gid for qmaild, qmaill,
qmailp, and alias, and the qmail gid for qmailq, qmailr, and qmails.
3. Compile the programs:
# make
4. Create the formatted
man pages, *.0:
# make man
5. Create the qmail directory
tree:
# make setup
6. Run instcheck to
make sure it doesn't print any warnings:
# make check
7. Read INSTALL.ctl and
FAQ.
Minimal survival command:
# ./qmail-config
8. Read INSTALL.alias.
Minimal survival command:
# (cd ~alias;
touch .qmail-postmaster .qmail-mailer-daemon .qmail-root)
# chmod 644
~alias/.qmail*
9. Read INSTALL.mbox.
10. Read qmail-upgrade.0.
This is what your users will need to know
about the switch from sendmail to
qmail.
Upgrading from sendmail
to qmail
-
Read INSTALL.boot. You must replace
the sendmail invocation in your boot scripts with an appropriate
qmail invocation.
-
Kill the sendmail daemon.
You should first kill -STOP the daemon; if any children are running, you
should kill -CONT, wait, kill -STOP again, and repeat. If there aren't
any children, kill -TERM and then kill -CONT.
-
Replace sendmail with a link to qmail's
``sendmail'' wrapper:
# mv /usr/lib/sendmail /usr/lib/sendmail.bak
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
-
Set up qmail-smtpd in /etc/inetd.conf
(all on one line):
smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env
tcp-env /var/qmail/bin/qmail-smtpd
-
Reboot. (Or kill -HUP
your inetd and make sure the qmail daemons are running.)
-
Try to flush the sendmail queue:
# /usr/lib/sendmail.bak -q
You can safely run sendmail.bak -q (or even sendmail.bak -q15m)
while qmail is running. Do this until the sendmail queue is empty.This
may take several days.
-
Disable all the sendmail and binmail
programs in your system. The safest approach is to chmod
0 everything. Some locations to check:
/usr/sbin/sendmail, /usr/lib/sendmail.bak,
/usr/lib/sendmail.mx, /bin/mail, /usr/libexec/mail.local.
Differences after
the system switches
from
sendmail
to qmail
-
qmail-local sends incoming mail to ~you/Mailbox
by default, not /usr/spool/mail/you.
Your system administrator has changed your MAIL environment
variable so that your mail reader
looks for ~you/Mailbox. (/usr/spool/mail is a massive security
problem.)
-
qmail-local pays no attention to .forward.
It has a much better mechanism, .qmail,
so that you can handle not only forwarding but even your own
mailing lists.
-
qmail-local pays no attention to /etc/aliases.
Your system administrator can use the
.qmail mechanism instead.
-
qmail-inject has a completely different philosophy from sendmail
on interpreting non-fully-qualified
host names. It uses fixed rules, not
DNS. Some examples at UIC:
russet ------> russet.math.uic.edu
newton ------> newton.math.uic.edu
ut.ee ------>
ut.ee (a host in Estonia)
ut.ee+ ------> ut.ee.uic.edu
uicvm+ ------> uicvm.uic.edu
Here the default domain name
(for hosts without dots) is math.uic.edu,
and the plus domain name
is uic.edu.
-
Unlike sendmail, qmail-inject doesn't
replace host names with canonical names.
Example:
qmail-inject won't change postmaster@ftp.cs.berkeley.edu
in your header to
postmaster@kohler.cs.berkeley.edu.
-
qmail-local adds a new
field, Delivered-To, before every
delivery. It uses the contents of Delivered-To to prevent mail
forwarding loops.
-
If you send a message with only Bcc recipients, qmail-inject
will add
Cc: recipient list not shown:;,
rather than sendmail's privacy-invading Apparently-To
header field.
QMAIL MAILING LISTS
-
sendmail deals with aliases, forwarding, and mailing lists
at the very heart of the mail system. qmail takes a radically different
approach. It gives you the power
to set up your own mailing lists without pestering your system
administrator.
-
Under qmail, you are in charge of all
addresses of the form you-anything. The
delivery of you-anything
is controlled by ~you/.qmail-anything,
a file in your home directory.
Example: if you want
to set up a bug-of-the-month-club mailing list,
you can put a list of addresses
into ~you/.qmail-botmc.
Any mail to you-botmc will
be forwarded to all of those addresses.
Mail directly to you is controlled by ~you/.qmail.
You can even set up a catch-all, ~you/.qmail-default,
to handle unknown
you- addresses.
-
Your .qmail files, like
your old .forward, may list
files, forwarding addresses, or other programs to run.
(But beware that the syntax is a bit different; see dot-qmail(5)
for more details.) qmail-local automatically
detects forwarding loops the instant they occur, even if
they happen indirectly through other hosts.
-
Addresses that don't contain a username are handled by the
alias user.
For example, your system administrator has set up ~alias/.qmail-postmaster
to handle mail for Postmaster.