sendmail +apache+openwebmail邮件服务器安装配置

拓拔泉
2023-12-01

sendmail 邮件服务器安装配置:

1.查看sendmail 安装情况
# rpm -q sendmail m4
2.安装sendmail-cf ...rpm 与sendmai-doc...rpm包
# rpm -ivh sendmail-cf ...rpm / sendmai-doc...rpm
3.安装pop3
# rpm -ivh dovecot...rpm
4.修改sendmail.mc文件
#vi /etc/mail/sendmail.mc
找到:DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
把这里的:127.0.0.1改为:0.0.0.0
找到:
dn1 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dn1 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
把这里的dn1去掉(注意:不要让这二行前面有空格)
然后生成sendmail.cf文件(请先备份sendmail.cf文件):
#cd /etc/mail
#cp sendmail.cf sendmail.cf.rw
#m4 sendmail.mc > sendmail.cf
5.修改access 文件 并生成数据库
#vi access
最后一行加上你的网络以及域名地址(多个VLAN都添加):
如:

localhost.localdomain             RELAY

localhost                                RELAY

127.0.0.1                               RELAY

test.com.cn                           RELAY

192.168.1                             RELAY

192.168.2                             RELAY

生成数据库:
#makemap hash access.db < access
6.修改dovecot.conf文件
#vi /etc/dovecot.conf
找到:protocols = imap imaps 在后面加上pop3 pop3s
7.启动saslauthd和dovecot服务
#chkconfig --level 345 dovecot on
#chkconfig --level 234 saslauthd on
#service saslauthd restart
#service dovecot restart
#service sendmail restart
8.检查服务是否启动:
#netstat -ntpl |grep 25
#netstat -ntpl |grep 110
9.测试邮件:

这样,你的sendmail就安装配置成功了!

10.安装Apache 2.0.46-38,
#rpm -ivh httpd-devel-2.0.46-38.i386.rpm
#rpm -ivh httpd-2.0.46-38.i386.rpm
11.修改 vi /etc/httpd/conf/httpd.conf
找到 ServerName
替换为
ServerName mail.test.com:80
修改一下性能参数,打开保持连接功能加快客户端访问:
找到
KeepAlive Off
改为
KeepAlive On
还有一些参数:
MaxClients 150 --------同一时间最大连接数,
ServerAdmin xxx@test.com-------改为网管的邮箱
Timeout 300 -------300秒没有反应就断开
12.重启httpd服务
[root@asup3 mail]# service httpd restart
停止 httpd?                                              [  确定  ]
启动 httpd?                                              [  确定  ]
13.Openwebmail,先要安装支持包。
#rpm -ivh perl-CGI-2.81-88.i386
#rpm -ivh perl-suidperl-5.8.0-88.i386  
#rpm -ivh perl-Compress-Zlib-1.21-RH9.i386
#rpm -ivh perl-Text-Iconv-1.2-RH80.i386
14.安装并更新openwebmail的脚本

下载地址:http://turtle.ee.ncku.edu.tw/openwebmail/download/redhat/rpm/daily-build/
#rpm -ivh openwebmail-2.41-20041220.i386.rpm
# speedy_convert
Converting suidperl to speedy_suid...
Done
vi /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
找到
dbmopen_ext             none
改为:
dbmopen_ext             %dbm_ext%
首次运行更改默认的域名:
修改:vi /var/www/cgi-bin/openwebmail/etc/default/openwebmail.conf
domainnames//xxx.com.cn    ----------申请的域名
smtpserver//XXX.XXX.XXX.X  -------------服务器的IP地址
smtpport25       //               -------------smtp的端口
15.运行初始化脚本
# ./openwebmail-tool.pl --init 
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.21-8smp i686
Perl: 5.008
WebMail: Open WebMail 2.41 200100520
Send the site report?(Y/n) y
sending report...
Thank you.

 

16.现在你就可以网页登录收发邮件了,但启动网页默认为英文,改为中文:
#vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
找到
default_language                auto
改为
default_language        zh_CN.GB2312
再找
default_iconsetDefault
改为
default_iconsetCool3D.Chinese.Simplified
这样你的界面和所有按钮都是简体中文。
在IE中输入http://192.168.1.100/cgi-bin/openwebmail/openwebmail.pl就会出现主界面了(注意不能用root登录)
输入的地址太长了,修改一下,
#vi /etc/httpd/conf/httpd.conf

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
下面加上:
ScriptAlias / "/var/www/cgi-bin/openwebmail/openwebmail.pl"
Alias /data "/var/www/data"

 

一些错误的解决办法:


1.Can't locate Text/Iconv.pm in @INC .....
解决:iconv是用来支持多国的字集转换功能,但可能在编辑时有错
cp /var/www/cgi-bin/openwebmail/misc/patches/iconv.pl.fake /var/www/cgi-

bin/openwebmail/shares/iconv.pl

2.初始化: /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init,发生以下错误:

Script is not setuid/setgid in suidperl
解决:进行权限修改
chmod 4755 -R /var/www/cgi-bin/openwebmail

3.对邮件地址发送邮件后回复451 Server configuration error
解决:编辑/etc/postfix/main.cf,找到smtpd_client_restrictions = ,取消限制即可

4.无法启动SMTP
解决:由于Redhat9默认安装了Sendmail,在安装Postfix时只是killall了sendmail进程,而没

有把程序改名,服务器重启后,Sendmail自动占用25端口,导致Postfix无法使用SMTP传输,停

止Sendmail进程并把程序改名即可

5.OpenWebmail编译后文件损坏,使用rpm -e命令卸载显示无文件,也无法重新安装
解决: 如果软件包已安装的情况下仍打算安装同一版本的软件包,可以使用 --replacepkgs 选

项,它告诉RPM 来忽略这个错误:
rpm -ivh --replacepkgs

6.’/usr/local/www/cgi-bin/openwebmail/openwebmail-*.pl’ must setuid to root
#vi /var/...../etc/suid.conf
 yes 更改為 no
#chmod 4555 /usr/bin/suidperl

按下面的标准修改httpd.conf

#vi /etc/httpd/conf/httpd.conf

<Directory "/var/www/cgi-bin">
    AllowOverride All
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
7.无法建立 /var/www/cgi-bin/openwebmail/etc/sessions/xxx.session.xxx(Permission

denied)
#chmod 771 /var/www/cgi-bin/openwebmail/etc/sessions
8.@#^&&*//var/log/openwebmail.log(Permission denied)
#touch /var/log/openwebmail.log
#chmod 660 /var/log/openwebmail.log

 类似资料: