Reference:
The Qmail howto v2
By Adam Mckenna
Http://www.flounder.net/qmail/qmail-howto.html
Life with Qmail
By Dave sill
Http://www.lifewithqmail.org/lwq.html
XX Operating System: RedHat Linux 7.2 (enigma)
Required software:
Qmail-1.03.tar.gz
Qmail-103.patch
Ucspi-tcp-0.88.tar
Daemontools-0.76.tar.gz
MySQL-3.22.32-1.i386.rpm
MySQL-client-3.22.32-1.i386.rpm
MySQL-share-3.22.32-1.i386.rpm
MySQL-devel-3.22.32-1.i386.rpm
Vpopmail-4.9.8.tar.gz
Vqsignup-0.5.tar.gz
Sqwebmail-1.2.0.tar.gz
All software is stored in the/home/kingsix directory.
Set the hostname of the test machine to testmail.com.cn.
1. Install Qmail
Delete Sendmail completely before installation (the mail server that comes with Linux)
Killall-term sendmail
Rpm-e -- nodeps sendmail
[Root @ testmail kingsix] # tar zxvf qmail-1.03.tar.gz
Patch Qmail
[Root @ testmail kingsix] # cp qmail-103.patch qmail-1.03
[Root @ testmail kingsix] # cd qmail-1.03
[Root @ testmail qmail-1.03] # patch-P1 <qmail-103.patch
This patch modifies the DNS. c file to solve some Domain Name Service problems.
Create the/var/Qmail directory.
Create the groups and users required to run Qmail:
# Groupadd nofiles
# Useradd-G nofiles-D/var/Qmail/alias-S/bin/false alias
# Useradd-G nofiles-D/var/Qmail-S/bin/false qmaild
# Useradd-G nofiles-D/var/Qmail-S/bin/false qmaill
# Useradd-G nofiles-D/var/Qmail-S/bin/false qmailp
# Groupadd Qmail
# Useradd-G Qmail-D/var/Qmail-S/bin/false qmailq
# Useradd-G Qmail-D/var/Qmail-S/bin/false qmailr
# Useradd-G Qmail-D/var/Qmail-S/bin/false qmails
Next, compile Qmail:
[Root @ testmail qmail-1.03] # Make setup check
If the compilation is successful, the directory structure of Qmail will be complete under/var/Qmail.
2. Install daemontools
[Root @ testmail kingsix] # tar zxvf daemontools-0.76.tar.gz
The Admin directory will be generated under the kingsix directory
[Root @ testmail kingsix] # cd Admin
[Root @ testmail admin] # cd daemontools-0.76
[Root @ testmail daemontools-0.76] # package/install
Install daemontools.
3. Qmail Configuration
Add domain name for Qmail
[Root @ testmail qmail-1.03] #./config-fast testmail.com.cn
Modify the locals and rcpthost files under the/var/control directory.
4. Install Qmail alias
[Root @ testmail qmail-1.03] # cd/var/Qmail/alias
[Root @ testmail alias] # echo admin>. Qmail-Root
[Root @ testmail alias] # echo admin>. Qmail-postmaster
[Root @ testmail alias] # echo admin>. Qmail-mailer-daemon
5. Assemble daemontools and create a control directory
The following settings enable Qmail automatically when the system starts. Use the svcan tool in daemontool. Install these tools
Under the/usr/local/bin directory.
# Mkdir-P/var/Qmail/supervise/Qmail-send/log
# Mkdir-P/var/Qmail/supervise/Qmail-smtpd/log
# Chmod + T/var/Qmail/supervise/Qmail-send
# Chmod + T/var/Qmail/supervise/Qmail-smtpd
# Mkdir-P/var/log/Qmail-send
# Mkdir-P/var/log/Qmail-smtpd
# Chown-r qmaill/var/log/Qmail
Edit some script files under each directory
Go to the/var/Qmail/supervise/Qmail-send directory and create a file named run with the following content:
#! /Bin/bash
Exec/var/Qmail/RC
Go to the/var/Qmail/supervise/Qmail-send/log directory and create a file named run. The content is as follows:
#! /Bin/bash
Exec/usr/local/bin/setuidgid qmaill/usr/local/bin/multilog t s2500000/var/log/Qmail-send
Go to the/var/Qmail/supervise/Qmail-smtpd directory and create a file named run with the following content:
#! /Bin/sh
Qmailduid = 'id-u qmaild'
Nofilesgid = 'id-G qmaild'
Exec/usr/local/bin/softlimit-M 2000000/
/Usr/local/bin/tcpserver-H-r-v-p-x/etc/tcp. SMTP. CDB/
-U $ qmailduid-G $ nofilesgid 0 SMTP/var/Qmail/bin/Qmail-smtpd 2> & 1
Go to the/var/Qmail/supervise/Qmail-smtpd/log directory and create a file named run. The content is as follows:
#! /Bin/sh
Exec/usr/local/bin/setuidgid qmaill/usr/local/bin/multilog t s2500000/var/log/Qmail-smtpd
Modify the Script Attribute to Executable
Chmod + x run
6. Access Control
Edit the/etc/tcp. SMTP File
127.0.0.1: Allow, relayclient = ""
192.168.2.: Allow, relayclient = ""
: Allow
Allow arbitrary forwarding on the local machine and local area network. However, tcpserver works by reading the CDB file, so you need to use tcprules to convert the TCP. SMTP File
# Tcprules/etc/tcp. SMTP. CDB/etc/tcp. SMTP. tmp </etc/tcp. SMTP
7. Create/var/Qmail/RC
# Cp/var/Qmail/boot/home/var/Qmail/RC
Edit RC
#! /Bin/sh
# Using splogger to send the log through Syslog.
# Using Qmail-Local to deliver messages ~ /Mailbox by default.
Exec env-Path = "/var/Qmail/bin: $ path "/
Qmail-start./maildir/splogger Qmail
Add the executable attribute chmod + x RC of RC.
8. Start Qmail
# Mkdir/service
# Ln-S/var/Qmail/supervise/*/service/
View processes with PS, and you can see processes related to supervise and qmail.
An email server is installed in this way.