文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Red Hat AS4 上架设OpenWebMail

Red Hat AS4 上架设OpenWebMail

时间:2006-04-25  来源:陆阳

Red Hat fedora core2 AS4 + Postfix + dovecot + Apache + OpenWebMail 安装笔记

 

作者:陆阳

电子邮箱:[email protected]

msn:[email protected]

完稿日期:2006年4月25日

版权说明:本文章的内容归作者版权所有,同时也接受大家的转贴,但一定要保存作者信息和出处,多谢!

 

经过两天的努力探索,终于搞定了,请大家仔细阅读我的文档,相信会让你少走很多弯路。本人是在公司的服务器上完成实验的,公司的机器是DELL的poweredge系列机 ,装的系统是RedHat  fedora core2 AS4 (Red Hat 3.4.3-9.EL4),只要保证你的系统也是EL4就可以了。系统中MTA服务的软件有许多,常用“Sendmail、Qmail、Postfix”等软件,本文使用RedHat AS4 + Postfix + dovecot + Apache + OpenWebMail制作一个集POP和WebMail等功能的电子邮件系统(注以下的操作请使用root用户来进行)

 

Step0、实验环境:

 

网络域名:happy.com

DNS主机名称:pdc.happy.com

DNS主机IP地址:192.168.1.254

邮件主机名称:mail.happy.com

邮件主机IP地址:192.168.1.253

操作系统:RedHat AS4 (Red Hat 3.4.3-9.EL4)

 

 不启动SELinux服务:

 

Step1、DNS服务器的配置:

 

参考资料“Red Hat Enterprise Linux 4.1下配置BIND -9.2.4-2安装笔记”

连接地址:http://www.gd-linux.com/bbs/showthread.php?t=2866

 

Step2、安装所需要的软件清单:

 

1)postfix-2.2.5-3.rhel4.rpm  邮件发送

2)postfix-pflogsumm-2.1.5-4.2.rhel4.rpm 

3)cyrus-sasl-2.1.19-5.rhel4.i386.rpm  用于smtp验证

4)dovecot-0.99.11-2.rhel4.1.rpm  安全的IMAP and POP3 server.收信用

5)httpd-2.0.52-12.ent.rpm  负责http服务

6)perl-suidperl-5.8.5-12.1.1.i386.rpm 生成suid,必须和你的perl版本相同,如配套的必须有perl-5.8.5-12,否则安装不能成功,我就在这里失败过.

7)perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm 压缩用

8)perl-5.8.5-12.1.i386.rpm 版本必须与perl-suidperl-5.8.5-12.1.1.i386.rpm相同

9)openwebmail-2.51-20050627.i386.rpm openwebmail的程序

10)perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm  CGI加速工具,请务必用2.22及以上版本,否则可能会失败,官方文档也是这样说的。

11)perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm  perl的text工具

12)perl-CGI-3.05-1.src.rpm             CGI工具

 

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

说明:软件清单中的postfix+cyrus-sasl+dovecot+httpd也可以在安装系统时一起安装。

安装openwebmail 2.51系统所需要的软件可以到下列地址下载:

http://openwebmail.org/openwebmail/download/redhat/rpm/release

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

 

Step3、postfix的安装过程:

 

#killall sendmail  (停止所有的Sendmaail进程)

sendmail: no process killed


       # rpm -ivh postfix-2.2.5-3.rhel4.i386.rpm

Preparing...     ########################################### [100%]

       1:postfix        ##################################### [100%]

链接 /usr/share/man/man8/sendmail.8.gz 到从mta-sendmailman(/usr
          /share /man /man1/sendmail.1.gz mta-sendmailman)不正确

 

Step4、启动postfix + dovecot服务过程:

 

# service postfix start

Starting postfix:                                          [  确定  ]

 

# service dovecot start

启动 Dovecot Imap:                                     [  确定  ]

 

Step5、修改/etc/dovecot.conf文件:

 

#protocols = imap imap3

更改为:

protocols = imap imap3 pop3 pop3s (启动imap imap3 pop3 pop3s功能)

 

auth_passdb = pam

更改为:

auth_passdb = shadow

 

# service dovecot restart(重新启动dovecot服务)

停止 Dovecot Imap:                                        [  确定  ]

启动 Dovecot Imap:                                        [  确定  ]

 

Step6、修改/etc/postfix/main.cf文件:

 

       #myhostname = host.domain.tld

更改为:

myhostname = mail.happy.com (指定运行Postfix邮件系统的主机名称)

 

#mydomain = domain.tld

更改为:

mydomain = happy.com (指定Postfix邮件系统使用的域名比例: happy.com)

 

#myorigin = $mydomain

更改为:

myorigin = happy.com (指定发件人所在的域名比例:happy.com)

 

#inet_interfaces = all

更改为:

Inet_interfaces =all (指定Postfix邮件系统监视的网络接口)

 

#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接收邮件时收件人的域名)

 

#mynetworks = host

更改为:

mynetworks = host (指定您所在的网络地址)

 

       # service postfix restart (重新启动postfix服务)

Shutting down postfix:                                     [  确定  ]

Starting postfix:                                            [  确定  ]

 

Step7、端口测试:

 

# telnet mail.happy.com 25 (测试25端口)
Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail. happy.com ESMTP Postfix

quit

221 Bye

Connection closed by foreign host.

# telnet mail.happy.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、安装openwebmail 2.51软件:

 

# service httpd restart (启动httpd服务)

停止 httpd:                                               [  确定  ]

启动 httpd:                                               [  确定  ]

 

# rpm -ivh perl-5.8.5-12.1.i386.rpm

# rpm -ivh perl-suidperl-5.8.5-12.1.1.i386.rpm //必须在安装perl-5.8.5-12.1.i386.rpm之后,安perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm之前。否则有时会有问题,我这里也失败过.openwebmail的官方文档也是这样写的

# 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-Text-Iconv-1.4-1.2.el4.rf.i386.rpm

 

# rpm -ivh openwebmail-2.51-1.i386.rpm
warning: openwebmail-2.51-1.i386.rpm: V3 DSA signature: NOKEY, key ID cfb164d8

Preparing...   ######################################### [100%]

1:openwebmail   ###################################### [100%]

      

You may login with non-root account from

http://mail.happy.com/cgi-bin/openwebmail/openwebmail.pl

      

# cd /var/www/cgi-bin/openwebmail/

# ./openwebmail-tool.pl –init  //必须先这样后,根据提示,才能改/etc/dbm.conf,否则会失败。

 

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

 

 

And execute './openwebmail-tool.pl --init' again!

 

ps: If you are running openwebmail in persistent mode,

    don't forget to 'touch openwebmail*.pl', so speedycgi

    will reload all scripts, modules and conf files in --init.

 

Step9、修改 /var/www/cgi-bin/openwebmail/etc/openwebmail.conf 文件:

 

domainnames         auto

更改为:

domainnames         happy.com (更改为自己定义的域名)

 

default_language             en

更改为:

default_language       zh_CN.GB2312 (更改为简体中文版介面)

 

default_iconset        Cool3D.Englist

更改为:

default_iconset        Cool3D.Chinese.Simplified (更改为中文3D按键)

Step10、修改/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf文件:

 

smtpserver                 127.0.0.1

更改为:

smtpserver                 192.168.1.253 (更改smtp服务器的地址)

 

authpop3_server                localhost

更改为:

authpop3_server                192.168.1.253 (更改pop3服务器的地址)

 

Step11、修改/var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf文件:

 

dbmopen_ext           none

更改为:

dbmopen_ext           .db

 

dbmopen_haslock       no

更改为:

dbmopen_haslock       yes

 

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 3.4.3-9.EL i686

Perl: perl-5.8.5

WebMail: Open WebMail 2.51 20050627

 

Send the site report?(Y/n) y (输入y,然后按回车键)

sending report...

 

Thank you.

如果没有这个提示,说明安装错误,只能重来。严格按我的步骤去做,包括次序。

Step13、增加限制用户发送电子邮的权限:

 

用户权限说明:

luyang不受发送限制(可以无限制的发送和接收Interanl、internet的电子邮件);

hejie、lichun受到发送限制(只可以发送和接收Internal内的电子邮件);

 

# useradd luyang(增加本地用户:luyang)

# useradd hejie(增加本地用户:hejie)

# useradd lichun(增加本地用户:lichun)

 

# passwd hejie(设置本地yer用户的密码)

Changing password for user yer.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

 

# passwd luyang(设置本地fandy用户的密码)

Changing password for user fandy.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

 

# passwd lichun(设置本地biao用户的密码)

Changing password for user biao.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

 

在main.cf文件中增加以下的代码:

 

# restrictions

smtpd_restriction_classes = local_only

local_only = check_recipient_access hash:/etc/postfix/local_domains, reject

 

smtpd_recipient_restrictions =
check_sender_access hash:/etc/postfix/local_senders
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname

 

在/etc/postfix/目录下建立local_senders文件,内容如下:

 

[email protected]      local_only

lichun@ happy.com     local_only

 

在/etc/postfix/目录下建立local_domains文件,内容如下:

 

happy.com            OK

mail.happy.com       OK

 

为local_senders、local_domains两个文件建立hash:

 

# postmap hash:/etc/postfix/local_senders

# postmap hash:/etc/postfix/local_domains

 

当hejie@ happy.com和[email protected]两个用户向其它域发送邮件时会出现以下的

错误信息:

 

554 5.7.1 <[email protected]>: Sender address rejected: Access denied

554 5.7.1 <[email protected]>: Sender address rejected: Access denied

 

Step14、测试webmail方式收发电子邮件:

 

在ie中输入以下地址:

http://mail. happy.com/cgi-bin/openwebmail/openwebmail.pl 

相关阅读 更多 +
排行榜 更多 +
浴血混战官方下载

浴血混战官方下载

飞行射击 下载
检票员模拟器免广告下载

检票员模拟器免广告下载

模拟经营 下载
最终前哨最终版手机版下载

最终前哨最终版手机版下载

休闲益智 下载