打印

完整qmail 解决方案(E文)

完整qmail 解决方案(E文)

Create an E-Mail Toaster
qmail + vpopmail + qmailadmin + vQamin + maildrop + qmail-scanner + SpamAssassin + ClamAV+ sqWebMail + Squirrelmail + MRTG

TOP

1. Start with a clean install of RedHat 9.0
If you are building a mail server from the ground up, you may want to install a clean operating system. This tutorial assumes that your OS is RedHat Linux 9.0, however, it should work for other flavors of Linux/Unix without too much modification. Choose a “server install” as we will need some of the packages that this mode installs by default; you will also want to install all the MySQL packages as well. You will find that you don't even need to install X-Windows (X-Windows burns up a lot of room, and you'll probably be spending all your time in a shell all the time anyway!).

By default, vpopmail (the virtual domain add-on for qmail) stores all the e-mail under /home/vpopmail. For this reason, you should consider the size of your /home volume. If you plan on generating a large volume of e-mails, you should adjust your /home volume accordingly. I typically partition an additional hard drive just for the /home volume.

TOP

2. Remove existing sendmail/pop/imap/httpd servers
rpm -e --nodeps sendmail
rpm -e –-nodeps openssl
#rpm -e --nodeps apache
Next, make sure that you have these packages installed:

rpm -q gdbm
rpm -q gdbm-devel
rpm -q openssl
rpm -q openssl-devel
rpm -q stunnel
rpm -q openssl-0.9.7a-2.i686.rpm
rpm -q mod_ssl-2.0.40-21.i386.rpm
rpm -q openssl-devel-0.9.7a-2.i386.rpm
rpm -q openssl-perl-0.9.7a-2.i386.rpm
rpm -q krb5-devel-1.2.7-10.i386.rpm
rpm -q krb5-server-1.2.7-10.i386.rpm
rpm -q krb5-workstation-1.2.7-10.i386.rpm
rpm -q krb5-libs-1.2.7-10.i386.rpm
rpm -q pam_krb5-1.60-1.i386.rpm
rpm -q mysql-devel-3.23.54a-11.i386.rpm
# for qmail-scanner you may need perl-suidperl. I got mine at http://www.megaloman.com/~hany/RPM/doors4.0/jr/PByName.html
rpm -q perl-suidperl
If you do not have these packages installed, download them and install them now. You should be able to find all these RPMs at http://www.rpmfind.net. I found my “perl-suidperl” at http://www.megaloman.com/~hany/R ... .8.0-55.1.i586.html

TOP

TOP

# Optional packages
wget http://www.jerfu.com/downloads/toaster/optionalScripts.tar.gz
wget http://telia.dl.sourceforge.net/ ... elmail-1.4.0.tar.gz
wget http://www.spamassassin.org/rele ... ssassin-2.55.tar.gz
wget http://telia.dl.sourceforge.net/ ... il-scanner-1.16.tgz
wget http://download.sourceforge.net/courier/maildrop-1.5.3.tar.bz2
wget http://telia.dl.sourceforge.net/ ... f/tnef-1.2.1.tar.gz
# Download the perl-suidperl RPM. If you aren't using RedHat
# you may need to find an alternate way of getting perl-suidperl installed.
wget ftp://rpmfind.net/linux/redhat/7 ... .1-34.99.6.i386.rpm
# Virus related optional packages
wget http://clamav.elektrapro.com/stable/clamav-0.60.tar.gz
# Test virus files
wget http://www.eicar.org/download/eicar.com
wget http://www.eicar.org/download/eicar.com.txt
wget http://www.eicar.org/download/eicar_com.zip
wget http://www.eicar.org/download/eicarcom2.zip
# Download MRTG and supporting packages
wget http://www.boutell.com/gd/http/gd-2.0.9.tar.gz
wget http://www.libpng.org/pub/png/src/old/libpng-1.0.12.tar.gz
wget http://www.libpng.org/pub/png/src/zlib-1.1.4.tar.gz
wget http://www.inter7.com/qmailmrtg7/qmailmrtg7-3.4.tar.gz
wget http://people.ee.ethz.ch/~oetike ... /mrtg-2.9.29.tar.gz
# Download PATCHES for the qmail apps for RH9
wget http://qmail.org/moni.csi.hu/pub ... ls-0.76.errno.patch
wget http://qmail.org/moni.csi.hu/pub ... il-1.03.errno.patch
wget http://qmail.org/moni.csi.hu/pub ... cp-0.88.errno.patch
wget http://qmail.org/moni.csi.hu/pub ... ls-0.76.errno.patch
wget http://qmail.org/moni.csi.hu/pub ... ls-0.76.errno.patch

TOP

4. Install daemontools
daemontools is a collection of tools for managing UNIX services. It will monitor qmail-send, and qmail-smtpd, and qmail-pop3d services.

The below steps assume that your "rc" directories are in /etc/rc.d, and your "init.d" path is "/etc/rc.d/init.d". If yours are different, please substitute paths accordingly.

mkdir -p /package
chmod 1755 /package
cd /package
tar -xpzf /var/src/tar/daemontools-0.76.tar.gz
cd admin/daemontools-0.76
patch -p1 < /var/src/tar/daemontools-0.76.errno.patch
package/install

TOP

5. Install ucspi-tcp
ucspi-tcp contains tcpserver and tcpclient command line tools for building client-server applications.

cd /var/src/
tar -xzf tar/ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch -p1 < /var/src/tar/ucspi-tcp-0.88.errno.patch
make
make setup check

TOP

6. Install qmailqmail is a replacement for sendmail. It's fast, free, and easy to use. Follow the next steps closely.

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

# we need to add the vpopmail user here
/usr/sbin/groupadd vchkpw
/usr/sbin/useradd -g vchkpw vpopmail

cd /var/src
tar -xzf tar/qmail-1.03.tar.gz
tar -xzf tar/toaster-scripts.tar.gz
bzip2 -d tar/qmail-toaster-0.5.patch.bz2

cd qmail-1.03
patch -p0 < ../tar/qmail-toaster-0.4.7.patch
patch -p1 < ../tar/qmail-1.03.errno.patch
make
make setup check

(cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root)
chmod 644 ~alias/.qmail*

# on the next line replace "full.hostname" with the hostname of your mail server
./config-fast full.hostname

make cert
# enter your company's information

cd /var/qmail/control
rm clientcert.pem
cp servercert.pem clientcert.pem
chown qmaild.qmail clientcert.pem

cp /var/src/toaster-scripts/rc /var/qmail/rc
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
echo ./Maildir/ >/var/qmail/control/defaultdelivery
cp /var/src/toaster-scripts/qmailctl /var/qmail/bin/

#Make qmail start at boot time.

TOP

ln -s ../init.d/qmail /etc/rc.d/rc0.d/K30qmail
ln -s ../init.d/qmail /etc/rc.d/rc1.d/K30qmail
ln -s ../init.d/qmail /etc/rc.d/rc2.d/S80qmail
ln -s ../init.d/qmail /etc/rc.d/rc3.d/S80qmail
ln -s ../init.d/qmail /etc/rc.d/rc4.d/S80qmail
ln -s ../init.d/qmail /etc/rc.d/rc5.d/S80qmail
ln -s ../init.d/qmail /etc/rc.d/rc6.d/K30qmail

ln -s /var/qmail/bin/qmailctl /etc/rc.d/init.d/qmail

chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

#Now create the supervise directories/scripts for the qmail services:
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
mkdir -p /var/qmail/supervise/qmail-pop3d/log
mkdir -p /var/qmail/supervise/qmail-pop3ds/log
chmod +t /var/qmail/supervise/qmail-send
chmod +t /var/qmail/supervise/qmail-smtpd
chmod +t /var/qmail/supervise/qmail-pop3d/log
chmod +t /var/qmail/supervise/qmail-pop3ds/log
cp /var/src/toaster-scripts/send.run /var/qmail/supervise/qmail-send/run
cp /var/src/toaster-scripts/send.log.run /var/qmail/supervise/qmail-send/log/run
cp /var/src/toaster-scripts/smtpd.run /var/qmail/supervise/qmail-smtpd/run
cp /var/src/toaster-scripts/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run
cp /var/src/toaster-scripts/pop3d.run /var/qmail/supervise/qmail-pop3d/run
cp /var/src/toaster-scripts/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run
cp /var/src/toaster-scripts/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run
cp /var/src/toaster-scripts/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
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
chmod 755 /var/qmail/supervise/qmail-pop3ds/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run
mkdir -p /var/log/qmail/smtpd
mkdir -p /var/log/qmail/pop3d
mkdir -p /var/log/qmail/pop3ds
chown qmaill /var/log/qmail /var/log/qmail/smtpd
chown qmaill /var/log/qmail/pop3d /var/log/qmail/pop3ds

#allow daemontools to start qmail
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service

#verify that it's running with qmailctl
qmailctl stat
qmail should now be up and running. I suggest reviewing steps 2 through 6 to help "cement" in your mind what we just did. We will now move on to the vpopmail section of the install

TOP

7. Install Vpopmail
Vpopmail is a virtual domain package add-on for qmail. It can handle multiple domains on a single IP address, and none of the user accounts are /etc/passwd or "system" accounts. NICE!

Because we will only be using vchkpw (the pop authentication tool) with qmail-smtpd for SMTP-AUTH, we don't want it to open relays. The patch applied below fixes this.

mysqladmin -u root password [enter new password here]
mysqladmin -u root -p reload
mysqladmin -u root -p refresh

cd /var/src
# the vchkpw group and vpopmail user was created while installing qmail for make cert
tar -xzf tar/vpopmail-5.3.20.tar.gz
cd vpopmail-5.3.20
./configure --enable-roaming-users=y –-enable-logging=y \
–-enable-learn-passwords=y –-enable-clear-passwd=y \
--enable-default-domain=your-main-domain-FQDN \
--enable-mysql –-enable-defaultquota=10M \
--enable-incdir=/usr/include/mysql/ --enable-libdir=/usr/lib/mysql/

edit the vmysql.h file and change the following lines:
#define MYSQL_UPDATE_SERVER "localhost"
#define MYSQL_UPDATE_USER "root"
#define MYSQL_UPDATE_PASSWD "[enter new password here]"

#define MYSQL_READ_SERVER "localhost"
#define MYSQL_READ_USER "root"
#define MYSQL_READ_PASSWD "[enter new password here]"

TOP


感谢一直以来您对我们的支持!
当前时区 GMT+8, 现在时间是 2008-8-29 09:32 京ICP证060528 号

Designed By 17DST