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