qmail邮件系统安装(freebsd 3.4) <br>
<br>本系统包括qmail基本系统、vpopmail、webmail。 <br>
<br>1。软件准备 <br>
<br>软件名称 说明 相关网站 <br>qmail 1.03 qmail 基本系统,须以下三个包 www.qmail.org <br>ucspi-tcp 0.84 tcpserver <br>daemontools 0.61 守护进程 <br>rblsmtpd 0.70 <br>checkpassword 0.81 口令检验(或用vpopmail) <br>vpopmail 3.4.11 支持虚拟域 www.inter7.com <br>qmailadmin 0.26e qmail web管理程序,须以下2包 <br>ezmlm 0.53 邮件列表 <br>autorespond 自动回复 <br>sqwebmail 0.31 web mail (next item needed) <br>lynx-2-8 browser <br>webmin 0.77 web方式服务器管理(apache,ftp,dns...) www.webmin.com <br>
<br>
<br>
<br>2。开始安装 <br>
<br>1.qmail 1.03 <br>
<br>1.1 建立qmail home dir <br># mkdir /var/qmail <br>
<br>1.2 添加必要用户,其它系统请参考INSTALL.ids <br># pw groupadd nofiles <br># pw useradd alias -g nofiles -d /var/qmail/alias -s <br>/nonexistent <br># pw useradd qmaild -g nofiles -d /var/qmail -s /nonexistent <br># pw useradd qmaill -g nofiles -d /var/qmail -s /nonexistent <br># pw useradd qmailp -g nofiles -d /var/qmail -s /nonexistent <br># pw groupadd qmail <br># pw useradd qmailq -g qmail -d /var/qmail -s /nonexistent <br># pw useradd qmailr -g qmail -d /var/qmail -s /nonexistent <br># pw useradd qmails -g qmail -d /var/qmail -s /nonexistent <br>
<br>1.3 compile qmail <br># make setup check <br>
<br>1.4 Compiling rblsmtpd is trivial on most systems: <br>
<br># tar zxvf rblsmtpd-0.70.tar.gz <br># cd rblsmtpd-0.70 <br># make <br># make setup check <br>//This will produce an rblsmtpd binary in /usr/local/bin. <br>
<br>1.5 config qmail <br># cd qmail-1.03 <br># ./config <br>If this doesn't work, then you've got some dirty work to do. <br>Read INSTALL.ctl. As long as all of your local IP's are in <br>your DNS, then you shouldn't have any problems. Otherwise you <br>can do the following: <br># ./config-fast your.full.host.name <br>
<br>This will create the necessary files in order to run qmail. <br>
<br>1.6 Install the qmail aliases. <br># cd ~alias <br># echo adam > .qmail-root //adam and bob is system <br>administrator <br># echo bob > .qmail-postmaster <br># echo bob > .qmail-mailer-daemon <br>
<br>1.7 建立qmail启动文件,将该行放入/usr/local/etc/rc.d/qmail.sh (csh -cf <br>
...) <br># cp /var/qmail/boot/home /var/qmail/rc <br>// 注意,此时如果打算使用Maildir可编辑rc文件,用Maildir替换Mailbox <br># csh -cf '/var/qmail/rc &' <br>
<br>If you've decided you want to use Maildirs, all you need to do <br>execute the following command in your home directory: <br>$ /var/qmail/bin/maildirmake $HOME/Maildir <br>$ echo ./Maildir/ > ~/.qmail <br>
<br>1.8 Kill sendmail!! <br>
<br># killall -TERM sendmail <br># mv /usr/lib/sendmail /usr/lib/sendmail.old <br># mv /usr/sbin/sendmail /usr/sbin/sendmail.old <br># ln -s /var/qmail/bin/sendmail /usr/lib/sendmail <br># ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail <br>
<br>1.9 Set up qmail daemons. <br>
<br>1.9.1 Install daemontools and tcpserver. <br>
<br># tar zxvf ucspi-tcp-0.84.tar.gz <br># cd ucspi-tcp-0.84 <br># make <br># make setup check <br>
<br>1.9.2 Installing daemontools is just as easy. <br># tar zxvf daemontools-0.53.tar.gz <br># cd daemontools-0.53 <br># make <br># make setup check <br>
<br>1.10 Now all that is left to do is create the directories that <br>cyclog will log to. <br># mkdir /var/log/qmail <br># chown qmaill /var/log/qmail <br># mkdir /var/log/qmail/qmail-smtpd <br># mkdir /var/log/qmail/qmail-pop3d // if you are also using <br>qmail-pop3d <br># chown qmaill /var/log/qmail/* <br>
<br>1.11 修改/etc/tcp.smtp <br>Before we can start up our qmail smtpd, we need to do some <br>access control. The simplest way to do this is by using files <br>in /etc. I use /etc/tcp.smtp as my access control file. If you <br>don't need to do any access control, /etc/tcp.smtp can have <br>just one line: <br>:allow <br>Note that a default configuration does not allow for ANY <br>relaying, even from localhost. To allow relaying from <br>localhost and your local network, you would have to use <br>something like this: <br>127.0.0.1:allow,RELAYCLIENT="" <br>192.168.1.:allow,RELAYCLIENT="" <br>:allow <br>For more examples, man tcprules. <br>After you've created your rules, you need to activate them. <br>tcpserver works by reading a cdb (database) file. You use the <br>tcprules program to build the database file from your <br>/etc/tcp.smtp file. This is accomplished by the following <br>command: <br># tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp <br>
<br>
<br>
1.12 rblsmtpd <br>
<br>
# PATH=/var/qmail/bin:/usr/local/bin:$PATH <br>
# mkdir /var/lock/qmail-smtpd <br>
# mkdir /var/log/qmail/ <br>
# mkdir /var/log/qmail/qmail-smtpd <br>
# supervise /var/lock/qmail-smtpd tcpserver -v <br>
-x/etc/tcp.smtp.cdb -u71 -g1001 0 25 <br>
> rblsmtpd qmail-smtpd 2>&1 | setuser qmaill accustamp | <br>> setuser qmaill cyclog -s5000000 -n5 <br>/var/log/qmail/qmail-smtpd & <br>
<br>or, to block using ORBS and <br>RBL,注意:setuser在freebsd中用setuidgid代替 <br>
<br># supervise /var/lock/qmail-smtpd tcpserver -v <br>-x/etc/tcp.smtp.cdb -u71 -g1001 0 25 <br>> rblsmtpd rblsmtpd -rrelays.orbs.org qmail-smtpd 2>&1 | <br>setuser qmaill accustamp | <br>> setuser qmaill cyclog -s5000000 -n5 <br>/var/log/qmail/qmail-smtpd & <br>
<br>1.13 自动运行qmail <br>
<br>1.13.1 inetd方式 <br>
<br>smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env tcp-env <br>/usr/local/bin/rblsmtpd /var/qmail/bin/qmail-smtpd <br>
<br>1.13.2 xinetd方式 <br>
<br>service smtp <br>{ <br>socket_type = stream <br>protocol = tcp <br>wait = no <br>user = qmaild <br>server = /var/qmail/bin/tcp-env <br>server_args = /usr/local/bin/rblsmtpd <br>/var/qmail/bin/qmail-smtpd <br>only_from = 0.0.0.0 <br>} <br>
<br>1.13.3 tcpserver 方式 <br>
<br>Install the ucspi-tcp package, ( <br><a target=_blank href=http://pobox.com/~djb/ucspi-tcp.html.>http://pobox.com/~djb/ucspi-tcp.html.</a>) <br>Remove the smtp line from /etc/inetd.conf, <br>and put the line : <br>
<br>tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd <br>
<br>2>&1 | /var/qmail/bin/splogger smtpd 3 & <br>
<br>into your system boot scripts. Replace 7770 with your qmaild <br>uid, and replace 2108 with your nofiles gid. Don't forget the <br>&. <br>
<br>The change will take effect at your next reboot. By default, <br>tcpserver allows at most 40 simultaneous qmail-smtpd <br>processes. To raise this limit to 400, use tcpserver -c 400. <br>To keep track of who's connecting and for how long, run (on <br>two lines) <br>
<br>1.14 qmail-pop3d <br>
<br>tcpserver [-u uid -g gid] 0 110 /var/qmail/bin/qmail-popup <br>YOURHOST <br>/bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir & <br>
<br>一些重要概念可以参考qmail-howto and 《life with qmail》and qmail-faq <br>
<br>1.15 /usr/local/etc/rc.d/qmail.sh example <br>
<br>#!/bin/sh <br>
<br>csh -cf '/var/qmail/rc & ' <br>/usr/local/bin/tcpserver -x /etc/tcp.smtp.cdb -u 1004 -g 1003 <br>0 smtp /var/qmail/bin/qmail-smtpd 2>&1 <br>|/var/qmail/bin/splogger smtpd 3 & <br>
<br>/usr/local/bin/tcpserver 0 110 /var/qmail/bin/qmail-popup <br>byone /usr/local/vpopmail/bin/vchkpw <br>/var/qmail/bin/qmail-pop3d Maildir & <br>
<br>1.16 checkpassword //如果用vpopmail可以不装 <br>
<br>$ make <br># make setup check <br>
<br>2. vpopmail <br>
<br>2.1 检查硬盘空间,决定使用哪个slice建立vpopmail用户 <br>
<br># df <br>or # df -k <br>
<br>2.2 add group and user <br>
<br># pw groupadd vchkpw <br># pw useradd -g vchkpw vpopmail [-d /path/to/home/vpopmail] <br>
<br>2.3 建立 tcp.smtp <br>
<br>2.4 配置 安装 <br>
<br>$ ./configure --enable-roaming-users=y <br>$ make <br>$ su <br># make install-strip <br>
<br>3. qmailadmin <br>
<br>3.1 ezmlm <br>
<br>$ make <br>$ make man <br># make setup <br>
<br>3.2 autorespond <br>
<br>gcc -Wall -o autorespond autorespond.c <br>
<br>3.3 qmailAdmin <br>
<br>3.3.1. Before we can make and install there are a few things <br>to consider.. <br>a. do you have a vpopmail user and installed vchkpw <br>b. where is your cgi bin directory <br>c. where is your ezmlm directory <br>d. where is your autorespond directory <br>If you are missing any one of those you can stop reading this <br>now and go install it!! <br>
<br>3.3.2 install <br>
<br>$ ./configure --enable-cgibindir={dir} //HTTP server's cgi-bin <br>directory. <br>> --with-htmllibdir={dir} // qmailadmin HTML library <br>directory. <br>
<br># make <br># make install or make install-strip <br>
<br>4 sqwebmail <br>
<br>3.4.1 lynx2-8 <br>
<br>$ ./configure <br># make <br># make install <br>
<br>3.4.2 sqwebmail <br>
<br>$ ./configure --prefix=/usr/local/sqwebmail <br>> --with-htmllib={dir} <br>> --enable-cgibindir={dir} <br>> --enable-mimetypes=filelist //apache mime.types file <br>
<br>$ make <br># make check <br># make install-strip 或者 make install (不去除debug信息) <br>
<br>5 webmin <br>
<br># ./setup.sh //按提示做 <br>
|