- 安裝Sendmail
yum安裝或者rpm包安裝:
yum -y install sendmail sendmail-devel sendmail-cf sendmail-do m4 - 設置在系統3和5級別啓動
#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. 安裝Perl的FastCGI模塊
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. 配置Perl的FastCGI腳本(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添加FastCGI的Perl支持
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
還未修改,等操作確認後