Centos 4.4 + Postfix + dovecot + Apache + OpenWebM
时间:2006-12-12 来源:scream
Step0、实验环境:
网络域名:leiyin.cn
DNS主机IP地址:192.168.0. 3
邮件主机名称:leiyin.cn
邮件主机IP地址:192.168.0.4
操作系统:Centos 4.4 server
Step1、DNS服务器的配置:
参考资料:BIND安装笔记,有leiyin.cn的A记录和MX记录,可以添加CNAME记录pop.leiyin.cn和smtp.leiyin.cn
Step2、安装所需要的软件清单:
postfix-2.2.5-3.rhel4.rpm
cyrus-sasl-2.1.19-5.rhel4.i386.rpm
dovecot-0.99.11-2.rhel4.1.rpm
httpd-2.0.52-12.ent.rpm
openwebmail-2.51-1.i386.rpm
perl-5.8.5-36.RHEL4
perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
perl-Compress-Zlib-1.34-2.i386.rpm
perl-suidperl-5.8.5-36.SEL4.i386.rpm
perl-Text-Iconv-1.2-0.2.el4.rf.i386.rpm
--------------------------------------------------------------------------------------------------
说明:软件清单中的postfix+cyrus-sasl+dovecot+httpd+ perl-5.8.5-36也可以在安装系统时一起安装。
安装openwebmail 2.51系统所需要的软件可以到下列地址下载:
http://openwebmail.org/openwebmail/download/redhat/rpm/release
--------------------------------------------------------------------------------------------------
Step3、postfix的安装过程:
/etc/init.d/sendmail stop
yum install postfix
rpm -e sendmail
/etc/init.d/postfix start
Step4、启动postfix + dovecot服务过程:
# service postfix start
Starting postfix: [ 确定 ]
# service dovecot start
启动 Dovecot Imap: [ 确定 ]
Step5、修改/etc/dovecot.conf文件:
1、
#protocols = imap imap3
更改为:
protocols = pop3
2、
pop3_listen = *
3、
# service dovecot restart(重新启动dovecot服务)
停止 Dovecot Imap: [ 确定 ]
启动 Dovecot Imap: [ 确定 ]
Step6、修改/etc/postfix/main.cf文件:
1、
#myhostname = host.domain.tld
更改为:
myhostname = leiyin.cn (指定运行Postfix邮件系统的主机名称)
2、
#mydomain = domain.tld
更改为:
mydomain = leiyin.cn (指定Postfix邮件系统使用的域名)
3、
#inet_interfaces = all
更改为:
Inet_interfaces =all (指定Postfix邮件系统监视的网络接口)
4、
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain
更改为:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,
ftp.$mydomain (指定Postfix接收邮件时收件人的域名)
5、
mynetworks =(指定您所在的网络地址)
6、
#relay_domains = $mydestination
更改为:
relay_domains = $mydestination
7、
# service postfix restart (重新启动postfix服务)
Shutting down postfix: [ 确定 ]
Starting postfix: [ 确定 ]
Step7、端口测试:
# telnet mail.easy.com 25 (测试25端口)Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.easy.com ESMTP Postfix
quit
221 Bye
Connection closed by foreign host.
# telnet mail.easy.com 110 (测试110端口)Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK dovecot ready.
quit
+OK Logging out
Connection closed by foreign host.
Step8、SMTP 认证:
1、要完成SMTP认证需要Cyrus-SASL软件
2、Centos默认安装就有
3、vi /etc/sysconfig/saslauthd
MECH=shadow
4、
/etc/init.d/saslauthd start
chkconfig saslauthd on
5、
vi /usr/lib/sasl2/smtpd.conf
log_level: 3
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
6、
[root@linux ~]# vi /etc/postfix/main.cf
在末尾增加
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
然后找到relay_domains = $mydestination一段增加如下设置
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
reject_rbl_client relays.ordb.org
reject_rbl_client cbl.abuseat.org
reject_rbl_client bl.spamcop.net
7、
[root@linux ~]# service postfix restart
Step8、安装openwebmail 2.51软件:
1、
# service httpd restart (启动httpd服务)
停止 httpd: [ 确定 ]
启动 httpd: [ 确定 ]
2、
# rpm -ivh perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
# rpm -ivh perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm
# rpm -ivh perl-suidperl-5.8.5-36.SEL4.i386.rpm
# rpm -ivh perl-Text-Iconv-1.2-0.2.el4.rf.i386.rpm
# rpm -ivh openwebmail-2.51-1.i386.rpm
3、
# cd /var/www/cgi-bin/openwebmail/
4、
# ./openwebmail-tool.pl --init
5、
Please change './etc/dbm.conf' from
dbm_ext .db
dbmopen_ext none
dbmopen_haslock no
to
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock no
6、
And execute './openwebmail-tool.pl --init' again!
Step9、修改 /var/www/cgi-bin/openwebmail/etc/openwebmail.conf 文件:
1、
domainnames auto
更改为:
domainnames easy.com (更改为自己定义的域名)
2、
default_language en
更改为:
default_language zh_CN.GB2312 (更改为简体中文版介面)
3、
default_iconset Cool3D.Englist
更改为:
default_iconset Cool3D.Chinese.Simplified (更改为中文3D按键)
Step10、修改/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf文件:
1、
smtpserver 127.0.0.1
更改为:
smtpserver 192.168.1.253 (更改smtp服务器的地址)
2、
authpop3_server localhost
更改为:
authpop3_server 192.168.1.253 (更改pop3服务器的地址)
Step11、修改/var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf文件:
1、
dbmopen_ext none
更改为:
dbmopen_ext .db
2、
dbmopen_haslock no
更改为:
dbmopen_haslock yes
3、
smtpserver 192.168.1.253 (添加smtp服务器的地址)
Step12、继续运行openwebmail-tool.pl文件:
# ./openwebmail-tool.pl --init
creating db /var/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/lunar ...done.
Welcome to the Open WebMail!
This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:
OS: Linux 2.6.9-11.EL i686
Perl: 5.008005
WebMail: Open WebMail 2.51 20050228
Send the site report?(Y/n) y (输入y,然后按回车键)
sending report...
Thank you.
Step14、测试webmail方式收发电子邮件:
在ie中输入以下地址:
http://mail.easy.com/cgi-bin/openwebmail/openwebmail.pl
Step14、
chkconfig postfix on
Chkconfig dovecot on
Chkconfig httpd on
Chkconfig saslauthd on