qmail Installation Procedure
Applying patches for qmail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cd /usr/local/src/qmail-1.03
cp -p qmail-smtpd qmail-smtpd.original
patch -p0 < maildirquota.patch (obtain maildirquota.patch from elsewhere)
cd ..
patch -d ./qmail-1.03 < qmailqueue-patch (obtain qmailqueue-patch from elsewhere)
cd qmail-smptd-auth-0.31 (obtain from elsewhere)
cp README.auth base64.c base64.h ../qmail-1.03
patch -d ../qmail-1.03 < auth.patch
Creating qmail groups and users
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir /var/qmail
/usr/sbin/groupadd nofiles
/usr/sbin/useradd -g nofiles -d /var/qmail/alias alias
/usr/sbin/useradd -g nofiles -d /var/qmail qmaild
/usr/sbin/useradd -g nofiles -d /var/qmail qmaill
/usr/sbin/useradd -g nofiles -d /var/qmail qmailp
/usr/sbin/groupadd qmail
/usr/sbin/useradd -g qmail -d /var/qmail qmailq
/usr/sbin/useradd -g qmail -d /var/qmail qmailr
/usr/sbin/useradd -g qmail -d /var/qmail qmails
Compiling qmail
~~~~~~~~~~~~~~~~~
cd /usr/local/src/qmail-1.03
make setup check
./config
Installing ucspi-tcp
~~~~~~~~~~~~~~~~~~~~~
tar -zxvf ucspi-tcp-0.88.tar.gz
cd /usr/local/src/ucspi-tcp-0.88
make
make setup check
Installing daemontools
~~~~~~~~~~~~~~~~~~~~~~~
cd /usr/local/src
tar -zxvf daemon-tools-o.76.tar.gz
cd admin
cd daemontools-0.76
./package/install
ps -ef | grep svscan (to verify installation)
Setup RUN files
~~~~~~~~~~~~~~~~
chmod 755 /var/qmail/rc
mkdir -p /var/qmail/supervise/qmail-pop3d/log
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
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
chmod 755 /var/qmail/supervise/qmail-pop3d/run
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
Setup Linux run level (for RedHat)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cp -p qmailctl /var/qmail/qmailctl
ln -s /var/qmail/bin/qmailctl /etc/rc.d/init.d/qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc0.d/K30qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc1.d/K30qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc2.d/S80qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc3.d/S80qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc4.d/S80qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc5.d/S80qmail
ln -s /etc/rc.d/init.d/qmail /etc/rc6.d/K30qmail
ln -s /var/qmail/bin/qmailctl /usr/bin
Configure qmail
~~~~~~~~~~~~~~~~
echo ./Maildir/ >/var/qmail/control/defaultdelivery
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
mkdir -p /var/log/qmail/smtpd
chown qmaill /var/log/qmail /var/log/qmail/smtpd
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smptd /service
ln -s /var/qmail/supervise/qmail-pop3d /service
echo '127.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp
add ":allow" as last line of file "/etc/tcp.smtp"
qmailctl cdb
Configure POP3-before-SMTP
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you need POP3-before-SMTP authentication rather than "SMTP authentication",
you can install relay-ctrl by Bruce Guenter. The procedure is as follow: -
check the definitions in the conf-* files
./make
./installer (as root)
mkdir /var/spool/relay-ctrl/allow
chmod 700 /var/spool/relay-ctrl (writeable only to root)
chmod 777 /var/spool/relay-ctrl/allow
mkdir /etc/relay-ctrl
echo "/var/spool/relay-ctrl/allow" > /etc/relay-ctrl/RELAY_CTRL_DIR
echo ":allow,RELAYCLIENT='@fixup'" > /etc/relay-ctrl/RELAY_CTRL_RELAYCLIENT (optional, if you want to have a fixup address)
add line "* * * * * root envdir /etc/relay-ctrl /usr/sbin/relay-ctrl-age" (optional)
change your qmail-smtpd run file from:
tcpserver ... qmail-smtpd
to:
envdir /etc/relay-ctrl \
relay-ctrl-chdir \
tcpserver ... relay-ctrl-check qmail-smtpd
change your qmail-pop3d run file from:
tcpserver ... qmail-popup hostname checkpassword \
qmail-pop3d
to:
envdir /etc/relay-ctrl \
tcpserver ... qmail-popup hostname checkpassword \
relay-ctrl-allow \
qmail-pop3d
To replace Sendmail with qmail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rpm -e --nodeps sendmail
ln -s /var/qmail/bin/sendmail /usr/lib
ln -s /var/qmail/bin/sendmail /usr/sbin
To setup postmaster aliases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo graham > /var/qmail/alias/.qmail-root
echo graham > /var/qmail/alias/.qmail-postmaster
ln -s /var/qmail/alias/.qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon
cd /var/qmail/alias
chmod 644 .qmail-root .qmail-postmaster
Installing autorespond
~~~~~~~~~~~~~~~~~~~~~~~~
tar -zxvf autorespond-2.0.2.tar.gz
cd /usr/local/src/autorespond-2.0.2
make
make install
Installing vpopmail
~~~~~~~~~~~~~~~~~~~~
tar -zxvf vpopmail-5.2.1.tar.gz
cd /usr/local/src/vpopmail-5.2.1
/usr/sbin/groupadd vchkpw
/usr/sbin/useradd -g vchkpw -d /var/vpopmail vpopmail
./configure --prefix=/var --exec-prefix=/var --enable-roaming-users=y --enable-clear-passwd=y --enable-tcpserver-file=/etc/tcp.smtp --enable-md5-passwords=y --enable-learn-passwords=y
make
make install-strip
add line "40 * * * * /var/vpopmail/bin/clearopensmtp" into crontab
cd /var/vpopmail/bin
chmod 4755 vchkpw
chown root.root vchkpw
*default period to remove overdue IPs from /var/vpopmail/etc/open-smtp is every 3 hours.
Installing sqwebmail
~~~~~~~~~~~~~~~~~~~~~
bunzip2 sqwebmail-3.5.0.tar.bz2
tar -xvf sqwebmail-3.5.0.tar
cd /usr/local/src/sqwebmail-3.5.0
./configure --prefix=/var --with-cachedir=/var/cache/sqwebmail3 --enable-imageurl=/webmail3 --enable-imagedir=/var/www/html/webmail3 --enable-cgibindir=/var/www/cgi-bin/sqwebmail3 --enable-mimetypes=/etc/mime.types --disable-utf7-folder-encoding --without-authdaemon --with-authvchkpw
make configure-check
make
make check
make install-strip
make install-configure
touch /var/nochangingfrom
add line "0 * * * * /var/cleancache.pl" into crontab.
Installing ezmlm
~~~~~~~~~~~~~~~~~
cd /usr/local/src
mv ezmlm-idx-0.40/* ezmlm-0.53
cd ezmlm-0.53
patch < idx.patch
make clean
make; make man
make setup
Installing qmailadmin
~~~~~~~~~~~~~~~~~~~~~~~
cd /usr/local/src/qmailadmin-1.0.6
./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html --enable-qmaildir=/var/qmail --enable-vpopmaildir=/var/vpopmail --enable-autoresponder-bin=/usr/local/bin --enable-ezmlmdir=/usr/local/bin/ezmlm
make
make install-strip
Installing vqadmin
~~~~~~~~~~~~~~~~~~~
cd /usr/local/src/vqadmin-2.3.2
./configure --enable-qmaildir=/var/qmail --enable-vpopuser=vpopmail --enable-vpopgroup=vchkpw --enable-cgibindir=/var/www/cgi-bin
make
make install-strip
htpasswd -c /etc/httpd/conf/vqadmin.passwd admin
chown root.apache /etc/httpd/conf/vqadmin.passwd
chmod 640 /etc/httpd/conf/vqadmin.passwd
update /var/www/cgi-bin/vqadmin/.htaccess
update httpd.conf to include
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
restart Apache
Installing qmHandle
~~~~~~~~~~~~~~~~~~~~
cd /usr/local/src
mkdir qmHandle
mv qmHandle-1.0.0.tar.gz
cd qmHandle
tar -zxvf qmHandle.1.0.0.tar.gz
cp -p qmHandle /var/qmail/bin
Installing qmailanalog
~~~~~~~~~~~~~~~~~~~~~~~
cd /usr/local/src
bunzip2 qmailanalog-0.70.tar.bz2
tar -xvf qmailanalog-0.70.tar
cd qmailanalog-0.70
make
make setup check
* Use tail64nfrac rather than tai64nlocal, 'coz it is more compatible with qmailanalog. See http://www.swellfish.com/qmail/tai64nfrac.txt.
Setup qmail
~~~~~~~~~~~~
add rotate_multilog to /var/qmail/bin, and setup to run crontab. (e.g. 0 * * * * /var/qmail/bin/rotate_multilog)
Start qmail now
~~~~~~~~~~~~~~~~
qmailctl start
qmailctl stat
* Consider setting up smtproute through /var/qmail/control/smtproute. An example is as below: -
bancosantos.com.br:[200.224.36.36]
japanasia.com:[202.67.158.10]
Setup qmailmrtg
~~~~~~~~~~~~~~~~
Install mrtg first
Untar qmailmrtg7
make
make install
mkdir /var/www/html/qmailmrtg
copy qmail.mrtg.cfg and index.html to /var/www/html/qmailmrtg
edit qmail.mrtg.cfg and index.html
> Change: FQDN to your hostname
> Change: WorkDir to point to your http mrtg directory
> Change the log file locations to where you store your qmail logs
Add a crontab line
> */5 * * * * /usr/local/bin/mrtg /usr/local/apache/htdocs/qmailmrtg7/qmail.mrtg.cfg 2>&1 /dev/null
Run mrtg 3 times to get it setup
Reference:-
~~~~~~~~~~~~
http://www.qmail.org/top.html
http://www.lifewithqmail.org/lwq.html
http://shupp.org/toaster/
http://members.elysium.pl/brush/qmail-smtpd-auth/
http://www.swellfish.com/qmail/qmail_tips.html