qmail is an excellent MTA(Mail Transport Agent) written by Dan Bernstein.
Why qmail:
* Security. qmail is secure.
* Speed. qmail is capable of handing millions of deliveries per day on a moderate system.
* Reliability. qmail writes mail to disk before it announces success.
* Extremely easy virtual domain administration.
* User-controlled mailing lists using ezmlm.
* Intuitive, straightforward, and simple administration.
Requirements:
* You must be running UNIX or a UNIX-like operating system.
* You must have a working DNS, and your system must have a DNS name.
* You must have a working C compiler.
Install file list:
* netqmail-1.05.tar.gz
* ucspi-tcp-0.88.tar.gz
* daemontools-0.76.tar.gz
* vpopmail-5.4.0.tar.gz
* mysql-standard-4.0.20-pc-linux-i686.tar.gz
* apache_1.3.31.tar.gz
* php-4.3.7.tar.gz
* autorespond-2.0.4.tar.gz
* ezmlm-0.53.tar.gz
* ezmlm-idx-0.40.tar.gz
* qmailadmin-1.2.0.tar.gz
* sqwebmail-3.5.3.tar.gz
Patches:
* ezmlm-idx-0.53.400.unified_41.patch
Scripts:
* qmailctl
* inst_check
* qmailadmin_zh
* zh-cn/*
* images/webmail/*
Preparation:
Login the system as root.
mkdir -p /usr/local/src
mkdir -p /package
Move the files of installation, patches and scripts except daemontools-0.76.tar.gz to /usr/local/src
Move daemontools-0.76.tar.gz to /package
chmod 1755 /package
Start installation:
cd /usr/local/src
tar -xvzf netqmail-1.05.tar.gz
cd netqmail-1.05
./collate.sh # important sentence!!!
cd ..
tar -xvzf ucspi-tcp-0.88.tar.gz
rm *.tar # optional, unless space is very tight
cd /package
tar -xvzf daemontools-0.76.tar.gz
rm *.tar # optional, again
################################
# Install qmail
################################
mkdir /var/qmail
mkdir /etc/qmail
ln -s /etc/qmail /var/qmail/control
# Create users and groups
userdel alias
userdel qmaild
userdel qmaill
userdel qmailp
userdel qmailq
userdel qmailr
userdel qmails
groupdel nofiles
groupdel qmail
groupadd nofiles
useradd -g nofiles -d /var/qmail/alias alias
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails
cd /usr/local/src/netqmail-1.05/netqmail-1.05
make setup check
# If your DNS is configured properly, this script should be all you need at this point:
./config
# Or you can configure your domain.
./config-fast mail.myqmail.com
################################
# Install ucspi-tcp
################################
cd /usr/local/src/ucspi-tcp-0.88
patch < /usr/local/src/netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch
make
make setup check
################################
# Install daemontools
################################
cd /package
tar -xvzf daemontools-0.76.tar.gz
cd /package/admin/daemontools-0.76/src
patch < /usr/local/src/netqmail-1.05/other-patches/daemontools-0.76.errno.patch
cd ..
package/install
# Start qmail script
vi /var/qmail/rc
######## Write the following section to file:/var/qmail/rc ########
#!/bin/sh
# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default
exec env - PATH="/var/qmail/bin:$PATH" qmail-start "`cat /var/qmail/control/defaultdelivery`"
######## End ########
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
echo ./Maildir/ /var/qmail/control/defaultdelivery
mv /usr/local/src/qmailctl /var/qmail/bin/
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
# Create the supervise
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
vi /var/qmail/supervise/qmail-send/run
######## Write the following section to file:/var/qmail/supervise/qmail-send/run ########
#!/bin/sh
exec /var/qmail/rc
######## End ########
vi /var/qmail/supervise/qmail-send/log/run
######## Write the following section to file:/var/qmail/supervise/qmail-send/log/run ########
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
######## End ########
vi /var/qmail/supervise/qmail-smtpd/run
######## Write the following section to file:/var/qmail/supervise/qmail-smtpd/run ########
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 2000000 /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2&1
######## End ########
echo 20 /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
vi /var/qmail/supervise/qmail-smtpd/log/run
######## Write the following section to file:/var/qmail/supervise/qmail-smtpd/log/run ########
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd
######## End ########
chmod +t /var/qmail/supervise/qmail-send
chmod +t /var/qmail/supervise/qmail-smtpd
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
mkdir -p /var/log/qmail/smtpd
chown qmaill /var/log/qmail /var/log/qmail/smtpd
ln -s /var/qmail/supervise/* /service/
# Allow the local host to inject mail via SMTP:
echo '127.:allow,RELAYCLIENT=""' /etc/tcp.smtp
qmailctl cdb
# Stop and disable the installed MTA:
/etc/init.d/sendmail stop
/sbin/init.d/sendmail stop
/etc/rc.d/init.d/sendmail stop
# Uninstall the sendmail:
rpm -e --nodeps sendmail
# Verify that nothing is listening to the SMTP port (25):
netstat -a | grep smtp
# If something is running, make sure it's not qmail by doing:
qmailctl stop
# The repeat the netstat check:
netstat -a | grep smtp
# Replace any existing /usr/lib/sendmail with the qmail version:
mv /usr/lib/sendmail /usr/lib/sendmail.old # ignore errors