qmail在Linux,Solaris系统安装详解(转)

qmail在Linux,Solaris系统安装详解(转)[@more@]

  安装平台:Linux,Solaris

  版本:qmail-1.03

  安装的机器: mail.mydomain.com

  软件包:

  qmail-1.03 Qmail基本系统

  ucspi-tcp-0.88 tcpsever服务程序

  daemontools-0.70 监视工具

  checkpassword-0.81 pop3验证用户的程序

  ezmlm-0.53 邮件转发

  vpopmail-4.9.6-1 虚拟域用户pop3支持

  qmailadmin-0.35 虚拟域web管理

  autorespond-1.0.0 自动回复程序

  sqwebmail-1.2.0 webmail

  vqsignup-0.4 web方式用户注册

  软件来源:

  http://www.qmail.org

  http://www.inter7.com/qmail

  每个包安装前务必先仔细阅读INSTALL和FAQ,很多问题在FAQ都有解决方法。

  安装步骤:

  1. #mkdir /var/qmail

  2. # 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

  3. #tar xzvf qmail-1.03.tar.gz

  进入qmail目录后,仔细阅读一下README和INSTALL文件.然后开始编译qmail

  #make setup check

  4. #cd qmail-1.03

  #./config

  5. 建立系统别名

  # (cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root)

  # chmod 644 ~alias/.qmail*

  6. # cp /var/qmail/boot/home /var/qmail/rc

  # chmod 755 /var/qmail/rc

  ?? /var/qmail/rc

  修改其中 ./Mailbox 成? ./Maildir ,如下:

  # !/bin/sh

  # Using splogger to send the log through syslog.

  # Using qmail-local to deliver messages to ~/Maildir by default.

  exec env - PATH="/var/qmail/bin: $PATH"

  qmail-start ./Maildir splogger q

  其中 splogger qmail 指令是用??硷??硷?於 / 中。

  建立?板

   $ /var/qmail/bin/maildirmake /etc/skel/Maildir

   $ echo ./Maildir/ > ~/.qmail

  注意 Maildir 必???使用者所有,可以 chown ?更,?以 chmod 700 Maildir 韵定?限。

  7. 安砚 ucspi-tcp-0.88

  # tar zxvf ucspi-tcp-0.88.tar.gz

  # cd ucspi-tcp-0.88

  # make

  # make setup check

  ?行??被安砚於 /usr/local/bin 中。

  8. 安砚 checkpassword

  # tar zxvf checkpassword-0.81.tar.gz

  # cd checkpassword-0.81

  # make

  # make setup check

  # chmod og-rx /bin/checkpassword

  ?行? checkpassword ?被安砚於 /bin 中

  如果不对/etc/passwd中的用户开放mail,不需要装checkpassword,只要装vpopmail

  9. 安砚 daemontools

  # tar zxvf daemontools-0.70.tar.gz

  # cd daemontools-0.70

  # make

  # make setup check

  ?行??安砚於 /usr/local/bin 中

  安装本工具后可以用

  # mkdir /var/run/qmail

  # supervise /var/run/qmail /var/qmail/rc

  来启动qmail,可以用svc来关闭活重起qmail,用svstat监视qmail运行情况,(qmail FAQ)

  10. 安装 vpopmail

  # groupadd vchkpw

  # useradd -g vchkpw vpopmail

  # mkdir ~vpopmail/etc

  # echo ":allow" > ~vpopmail/etc/tcp.smtp

  # tar zvfz vpopmail-4.9.6-1.tar.gz

  # cd vpopmail-4.9.6-1

  # ./configure --enable-roaming-users=y --enable-default-domain=mydomain.com --enable-passwd=n

  # make

  # make install-strip

  # crontab -e

  40 * * * * /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null

  # cd /home/vpopmail/bin

  # ./vadddomain mydomain.com mydomain

  append mydomain.com to /var/qmail/control/rcpthosts

  11.停止sendmail 服?

  # killall -TERM sendmail (Linux)

  接著以 qmail 之 sendmail libraby 取代原有之 sendmail

  # mv /usr/lib/sendmail /usr/lib/sendmail.old

  # mv /usr/sbin/sendmail /usr/sbin/sendmail.old

  # ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

  # ln -s /var/qmail/sbin/sendmail /usr/sbin/sendmail

  移除 sendmail ??程序,以 Linux ?例:

  移除 inetd.conf 中的 sendmail 之韵定,以及 /etc/rc.d/init.d 下的 sendmail ???。(Linux)

  12.??qmail SMTP , POP3 daemon 系靳服?

  建立 SMTP 弈信??

  建立 /etc/tcp.smtp ?容?

  :allow

  此?接受任何Client端所办出之弈送信件

  若要拒睫某些IP所办出之Relay?改? /etc/tcp.smtp如下

  1.2.3.4:allow,RELAYCLIENT=""

  127.:allow, RELAYCLIENT=""

  如此,除1.2.3.4及127.*之外的所有位址,都?被拒睫弈送信件。

  接下?,弈? tcp.smtp 成? cdb 格式。

  # /usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

  注意:若? tcp.smtp 有任何?更,都必??咿 tcprules 弈?成? cdb 才?生效。

  另外,tcp.smtp 若?空白,?表示拒睫所有的弈送,因?盍韵的??? deny。

  至此,弈送??已建立,稍後?依此???? qmail-smtpd。

  韵定 SMTP 及 POP3 daemon 之??

  ?移除 inetd.conf 中有晷 smtp 及 pop3 的韵定 (加上 # ?)

  ?? /etc/services,改?以下韵定:

  smtp 25/tcp mail

  # pop-3 110/tcp #pop version 3

  # pop-3 110/udp

  pop3 110/tcp

  pop3 110/udp

  ?? SMTP:

  /usr/local/bin/tcpserver -v -x /etc/tcp.smtp.cdb

  -u UID -g GID 0 smtp /var/qmail/bin/qmail-smtpd 2>&1

  | /var/qmail/bin/splogger smtpd 3 &

  其中UID和GID?前述新增 qmail 系靳??之 qmaild 之 User ID,以及 nofiles 之 group ID。

  /var/qmail/bin/splogger那一行??log??在 /var/log/maillog。

  ?? POP3:

  ?????加入以下韵定:

  tcpserver -H -R 0 pop3

  /var/qmail/bin/qmail-popup mail.mydomain.com

  /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir &

  在/etc/rc.d/init.d下建立文件qmail,内容如下:

  -------------------------------------------

#! /bin/sh

case " $1" in

start)

echo -n "start qmail:"

/var/qmail/rc &

echo "."

echo -n "start smtp service:"

   

  # cd ../rc3.d

  # ln -s ../init.d/qmail S98qmail

  qmailadmin WEB方式管理qmail

  1 ezmlm

   $ make

   $ make man

  # make setup

  2 autorespond

  gcc -Wall -o autorespond autorespond.c

  cp autorespond /usr/local/bin/autorespond

  3 qmailAdmin

  3.1. Before we can make and install there are a few things to consider..

  a. do you have a vpopmail user and installed vchkpw

  b. where is your cgi bin directory

  c. where is your ezmlm directory

  d. where is your autorespond directory

  If you are missing any one of those you can stop reading this now and go install it!!

  3.2 install

  # ./configure

  # make

  # make install-strip

  浏览器中打开路径http://mail.mydomain.com/cgi-bin/qmailadmin

  用户postmaster;域mydomain.com;口令:mydomain

  WebMail -- SqWebmail

  # tar xvfz sqwebmail-1.2.0.tar.gz

  # cd sqwebmail-1.2.0

  # ./configure --without-authpam --without-authuserdb --enable-webpass=no --without-authpwd --without-authshadow

  # make configure-check

  # make (当我make的时候报错找不到db.h,cp /usr/include/db1/db.h /usr/include/db.h)

  # make check

  # make install-strip

  # make install-configure

  浏览器中打开路径http://mail.mydomain.com/cgi-bin/sqwebmail

  vqsignup

  # tar xvfz vqsignup-0.4.tar.gz

  # cd vqsignup-4.0

  按照INSTALL安装