您的位置:首页 > 大数据 > 人工智能

CentOS/Nginx/SendMail/Dovecat/Perl/OpenWebMail <构架邮件服务器>

2010-10-01 04:57 477 查看
安装Sendmail

yum安装或者rpm包安装:

yum -y install sendmail sendmail-devel sendmail-cf sendmail-do m4

设置在系统35级别启动

#chkconfig –level 35 sendmail on

#chkconfig –list sendmail

sendmail 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

#vim /etc/mail/local-host-names //添加邮件服务器的邮件服务域名

xxx.com

开启sendmail服务器的网络接口

#cp sendmail.mc sendmail.mc.bak 为了防止出错,备份配置文件

#vim /etc/mail/sendmail.mc

查 找:DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1,’)dnl

修改为:DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0,’)dnl

设置SMTP的用户认证

#vim /etc/mail/sendmail.mc

查找:dnl 52 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl

dnl 53 define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl

去掉前面注释:“dnl”

在sendmail服务器中使用了saslauthd服务程序提供用户认证功能,所以要开启它

#chkconfig –level 35 saslauthd on

#service saslauthd start

生成sendmail.cf文件

#cd /etc/mail

#m4 sendmail.mc > sendmail.cf

#service sendmail restart

用户管理

#groupadd mailuser 建立邮件用户组

#useradd -g mailuser -s /sbin/nologin mike 建立不能登录系统的邮件用户

#vim /etc/aliases sendmail使用aliases机制实现邮件别名和群发功能

admin: mike admin是mike的别名

testgroup: mike,john,tom,jack 邮件群发,向testgroup邮箱发送就是向4个人发送

# newaliases 对aliases.db数据库更新

安装POP3,IMAP功能

#yum install dovecot

#vim /etc/dovecot.conf

查 找:protocols = imap imaps

修改为:protocols = imap imaps pop3 pop3s

#chkconfig –level 35 dovecot on

#service dovecot restart

安装openwebmail

下载所需软件包:www.openwebmail.org www.rpmfind.net

yum install perl-CGI-SpeedyCGI perl-suidperl perl-Compress-Zlib perl-Text-Iconv

rpm –ivh –nodeps openwebmail-data-2.53-3.i386.rpm

rpm –ivh –nodeps openwebmail-2.53-3.i386.rpm

10. 初始化openwebmail系统

#/var/www/cgi-bin/openwebmail/openwebmail-tool.pl –init

11. 修改配置文件

#vim /var/www/cgi-bin/openwebmail/etc/openwebmail.conf

domainnames xxx.com

default_language zh_CN.GB2312

default_iconset Cool3D.Chinese.Simplified

12. 安装PerlFastCGI模块

FCGI: http://cpan.wenzk.com/authors/id/F/FL/FLORA/FCGI-0.71.tar.gz
#tar zxvf FCGI-0.71.tar.gz

#cd FCGI-0.71

#perl Makefile.PL

#make && make install

#rpm -ivh perl-FCGI-ProcManager-0.18-1.el4.rf.noarch.rpm

或者:yum install perl-FCGI-ProcManager

13. 配置PerlFastCGI脚本(perl-fast上传脚本文件到:/etc/init.d/ 目录下

#chmod +x /etc/init.d/perl-fast

#vim /etc/profile

添加以下内容:

export FCGI_SOCKET_PATH=”/tmp/perl-fastcgi.sock”

export FCGI_NPROCESSES=4

#source /etc/profile

#/etc/init.d/perl-fast &

14. 上传enable_perl.conf文件到:nginx/conf 目录下,然后为Nginx添加FastCGIPerl支持server

{

listen 80;

server_name mail.xxx.com;

charset gb2312;

access_log /wslogs/xxx.com/mail_access.log combined;

error_page 404 = http://www.xxx.com/error/404.html;
error_page 500 502 503 504 = http://www.xxx.com/error/50x.html;
location /

{

root /var/www;

index index.html index.htm index.php;

}

location ~* .*\.pl$

{

root /var/www;

include enable_perl.conf;

}

}

15. web服务器中发布openwebmail

为了浏览器中不用输入很长的地址,做一个引导页

#vim /var/www/index.php

<script>

location.href=”cgi-bin/openwebmail/openwebmail.pl”;

</script>

16. 文件权限的设置

#chown root.root /var/www/cgi-bin/openwebmail/

#chown root.mail /var/www/cgi-bin/openwebmail/*

#chmod 775 /var/www/cgi-bin/openwebmail/openwebmail*.pl

#chown root.mail /var/www/cgi-bin/openwebmail/openwebmail*.pl

#chmod 4555 /usr/bin/suidperl

#chmod 775 /var/www/cgi-bin/openwebmail/etc/sessions

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: