qmail+LDAP安装配置实例Word文件下载.docx
《qmail+LDAP安装配置实例Word文件下载.docx》由会员分享,可在线阅读,更多相关《qmail+LDAP安装配置实例Word文件下载.docx(17页珍藏版)》请在冰豆网上搜索。
然后解开安装下面步骤解开这些包
su-
umask022
cd/usr/local/src/qmail
tarzxvfqmail-1.03.tar.gz
tarxvfucspi-tcp-0.88.tar.gz
tarzxvfdaemontools-0.70.tar.gz
tarzxvfcheckpassword-0.90.tar.gz
解开的数据包应该处在qmail-1.03,ucspi-tcp-0.88,daemontools-0.70和checkpassword-0.90目录下,进入qmail目录。
cdqmail-1.03
建立相应的安装目录
由于qmail安装程序会产生其需要的子目录,所以只要生成安装所需的"
home"
目录:
mkdir/var/qmail
ln-s/usr/man/var/qmail/man
mkdir/etc/qmail
ln-s/etc/qmail/var/qmail/control
ln-s/usr/sbin/var/qmail/bin
生成qmail安装需要的用户以及组
#groupaddnofiles
#useradd-gnofiles-d/var/qmail/aliasalias
#useradd-gnofiles-d/var/qmailqmaild
#useradd-gnofiles-d/var/qmailqmaill
#useradd-gnofiles-d/var/qmailqmailp
#groupaddqmail
#useradd-gqmail-d/var/qmailqmailq
#useradd-gqmail-d/var/qmailqmailr
#useradd-gqmail-d/var/qmailqmails
编译安装
现在可以编译安装qmail:
makesetupcheck
在编译安装完成,需要进行配置如果DNS配置正确,只需执行下面的命令:
./config
如果config在DNS中不能找到主机名,则需要执行config-fast脚本:
./config-fastlongshine.com
qmail现在已经安装起来了,下面开始是启动和配置qmail。
安装ucspi-tcp
进入ucspi-tcp目录:
cd/usr/local/src/qmail/ucspi-tcp-0.88
make
这样ucspi-tcp安装起来了。
安装daemontools
进入daemontools目录:
cd/usr/local/src/qmail/daemontools-0.70
安装checkpassword
进入checkpassword目录:
cd/usr/local/src/qmail/checkpassword-0.90
注:
在某些LINUX版本中(我的安装环境redhat7.1),如RedHat7,可能在编译过程中会生成错误:
./compiletai64nlocal.c
tai64nlocal.c:
Infunction`main'
:
54:
warning:
assignmentmakespointerfromintegerwithoutacast
55:
dereferencingpointertoincompletetype
等等….
如果这样按照下面说明编辑tai64nlocal.c
#include
更改为:
生成/service目录:
mkdir/service
最后配置svscan使得当系统启动时候自动允许。
编辑/etc/inittab文件将下面一行加入文件最后(注意是在一行中):
SV:
123456:
respawn:
env-PATH=/usr/local/bin:
/usr/sbin:
/usr/bin:
/binsvscan/service/dev/console2>
/dev/console
然后执行下面命令重新读人/etc/inittab:
kill-HUP1
可以使用"
ps-ef|grepsvscan"
或者"
pswaux|grepsvscan"
证实svscan正在运行。
启动qmail
2.8.1./var/qmail/rc
编辑产生/var/qmail/rc文件将下面命令进入其中
#!
/bin/sh
#Usingstdoutforlogging
#Usingcontrol/defaultdeliveryfromqmail-localtodelivermessagesbydefault
execenv-PATH="
/var/qmail/bin:
$PATH"
qmail-start"
`cat/var/qmail/control/defaultdelivery`"
chmod755/var/qmail/rc
mkdir/var/log/qmail
在qmail中,支持三种邮件存储方式,分别是典型的/var/spool/mail方式、传统的Unixuser/Mailbox方式和新的user/Maildir方式,其中前两种方式为大多数的邮件客户端所支持,但是它们均存在安全上的隐患,所以在这里使用了第三种方式,下面分别叙述三种方式的建立方法:
/var/spool/mail方式
#cp/var/qmail/boot/proc/var/qmail/rc
user/Mailbox方式
#cp/var/qmail/boot/home/var/qmail/rc
user/Maildir方式
1)#cp/var/qmail/boot/home/var/qmail/rc
2)建立相应的邮件用户,例如:
#useraddtest
#passwdtest
3)使用qmail提供的工具建立Maildir,命令如下:
$/var/qmail/bin/maildirmakeMaildir
$echo./Maildir/>
.qmail
(注意这里必须以用户权限建立邮箱)
4)为了使root用户也能收发邮件,使用如下命令:
#sualias
$cd
#echo./Mailbox/>
/var/qmail/control/defaultdelivery
系统start-up文件
生成qmailctl脚本
#ForRedHatchkconfig
#chkconfig:
-3080
#description:
theqmailMTA
PATH=/var/qmail/bin:
/bin:
/usr/local/bin:
/usr/local/sbin
exportPATH
QMAILDUID=`id-uqmaild`
NOFILESGID=`id-gqmaild`
case"
$1"
in
start)
echo"
Startingqmail"
ifsvok/service/qmail-send;
then
svc-u/service/qmail-send
else
echoqmail-sendservicenotrunning
fi
ifsvok/service/qmail-smtpd;
svc-u/service/qmail-smtpd
echoqmail-smtpdservicenotrunning
if[-d/var/lock/subsys];
touch/var/lock/subsys/qmail
;
stop)
Stoppingqmail..."
qmail-smtpd"
svc-d/service/qmail-smtpd
qmail-send"
svc-d/service/qmail-send
if[-f/var/lock/subsys/qmail];
rm/var/lock/subsys/qmail
stat)
svstat/service/qmail-send
svstat/service/qmail-send/log
svstat/service/qmail-smtpd
svstat/service/qmail-smtpd/log
qmail-qstat
doqueue|alrm|flush)
SendingALRMsignaltoqmail-send."
svc-a/service/qmail-send
queue)
qmail-qread
reload|hup)
SendingHUPsignaltoqmail-send."
svc-h/service/qmail-send
pause)
Pausingqmail-send"
svc-p/service/qmail-send
Pausingqmail-smtpd"
svc-p/service/qmail-smtpd
cont)
Continuingqmail-send"
svc-c/service/qmail-send
Continuingqmail-smtpd"
svc-c/service/qmail-smtpd
restart)
Restartingqmail:
"
*Stoppingqmail-smtpd."
*Sendingqmail-sendSIGTERMandrestarting."
svc-t/service/qmail-send
*Restartingqmail-smtpd."
cdb)
tcprules/etc/tcp.smtp.cdb/etc/tcp.smtp.tmp<
/etc/tcp.smtp
chmod644/etc/tcp.smtp.cdb
Reloaded/etc/tcp.smtp."
help)
cat<
stop--stopsmailservice(smtpconnectionsrefused,nothinggoesout)
start--startsmailservice(smtpconnectionaccepted,mailcangoout)
pause--temporarilystopsmailservice(connectionsaccepted,nothingleaves)
cont--continuespausedmailservice
stat--displaysstatusofmailservice
cdb--rebuildthetcpservercdbfileforsmtp
restart--stopsandrestartssmtp,sendsqmail-sendaTERM&
restartsit
doqueue--sendsqmail-sendALRM,schedulingqueuedmessagesfordelivery
reload--sendsqmail-sendHUP,rereadinglocalsandvirtualdomains
queue--showsstatusofqueue
alrm--sameasdoqueue
flush--sameasdoqueue
hup--sameasreload
HELP
*)
Usage:
$0{start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"
exit1
esac
exit0
此脚本可以通过http:
//www.lifewithqmail.org/qmailctl-script-dt70获得
使用vi生成/var/qmail/bin/qmailctl基本将上面内容放入其中,然后将其安装在
/etc/init.d
/etc/rc.d/init.d
执行下面命令,产生链接:
ln-s../init.d/qmail/etc/rc0.d/K30qmail
ln-s../init.d/qmail/etc/rc1.d/K30qmail
ln-s../init.d/qmail/etc/rc2.d/S80qmail
ln-s../init.d/qmail/etc/rc3.d/S80qmail
ln-s../init.d/qmail/etc/rc4.d/S80qmail
ln-s../init.d/qmail/etc/rc5.d/S80qmail
ln-s../init.d/qmail/etc/rc6.d/K30qmail
ln-s/var/qmail/bin/qmailctl/etc/init.d/qmail
使得脚本可以执行qmailctl且进入系统命令中
chmod755/var/qmail/bin/qmailctl
ln-s/var/qmail/bin/qmailctl/usr/bin
supervise基本
现在产生qmailservices目录:
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
生成/var/qmail/supervise/qmail-send/run文件:
exec/var/qmail/rc
生成/var/qmail/supervise/qmail-send/log/run文件:
exec/usr/local/bin/setuidgidqmaill/usr/local/bin/multilogt/var/log/qmail
生成/var/qmail/supervise/qmail-smtpd/run文件:
MAXSMTPD=`cat/var/qmail/control/concurrencyincoming`
exec/usr/local/bin/tcpserver-v-R-l0-x/etc/tcp.smtp.cdb-c"
$MAXSMTPD"
-u"
$QMAILDUID"
-g"
$NOFILESGID"
0smtp/var/qmail/bin/qmail-smtpd2>
&
1
生成concurrencyincoming控制文件:
echo20>
/var/qmail/control/concurrencyincoming
chmod644/var/qmail/control/concurrencyincoming
生成/var/qmail/supervise/qmail-smtpd/log/run文件:
exec/usr/local/bin/setuidgidqmaill/usr/local/bin/multilogt/var/log/qmail/smtpd
使得所生成的脚本可执行:
chmod755/var/qmail/supervise/qmail-send/run
chmod755/var/qmail/supervise/qmail-send/log/run
chmod755/var/qmail/supervise/qmail-smtpd/run
chmod755/var/qmail/supervise/qmail-smtpd/log/run
建立log目录:
mkdir-p/var/log/qmail/smtpd
chownqmaill/var/log/qmail/var/log/qmail/smtpd
将supervise链接到/service:
ln-s/var/qmail/supervise/qmail-send/var/qmail/supervise/qmail-smtpd/service
注:
qmail系统应该自动起来。
如果不想此时候启动,执行:
qmailctlstop'
SMTP访问控制
允许本地主机通过SMTP发信:
echo'
127.:
allow,RELAYCLIENT="
'
>
>
/etc/tcp.smtp
qmailctlcdb
停止已经安装的MTA
如果MTA是Sendmail,应该使用下面命令中的一个停止sendmail工作:
/etc/init.d/sendmailstop
/sbin/init.d/sendmailstop
/etc/rc.d/init.d/sendmailstop
或者下面命令停止
killPID-of-sendmail
通过下面命令卸装Sendmail:
rpm-e--nodepssendmail
最后,使用qmail版本的sendmail代替系统/usr/lib/sendmail的sendmail:
mv/usr/lib/sendmail/usr/lib/sendmail.old#ignoreerrors
mv/usr/sbin/sendmail/usr/sbin/sendmail.old#ignoreerrors
chmod0/usr/lib/sendmail.old/usr/sbin/sendmail.old#ignoreerrors
ln-s/var/qmail/bin/sendmail/usr/lib
ln-s/var/qmail/bin/sendmail/usr/sbin
生成'
sendmail链接是重要的,因为有许多应用涉及发mail。
最后一步产生系统别名(aliases)
echoalias>
/var/qmail/alias/.qmail-root
/var/qmail/alias/.qmail-postmaster
ln-s.qmail-postmaster/var/qmail/alias/.qmail-mailer-daemon
chmod644/var/qmail/alias/.qmail-root/var/qmail/alias/.qmail-postmaster
qmailctlstart
添加pop3服务
生成/var/qmail/supervise/qmail-pop3d/run脚本包含下面内容:
exec/usr/local/bin/tcpserver-v-R-H-l00110/var/qmail/bin/qmail-popup
/bin/check