Openwebmail在Centos linux上的安装[postfix, linux, perl]

经过两天的钻研,openwebmail终于被我安装成功,因为它确实是“复杂”配置的一套软件。下面是我的安装过程记录,首先你不要被大量的文字吓倒。经过安装总结后才发现,其实不是很难!

安装环境:Centos linux 2.6.18-164.15.1.el5

已经安装好apache2(httpd 2.2.3-43) 与postfix 2.6.18-164.15.1及perl 5.8.8

假如你还未安装以上组建,必须先下载安装:

yum install httpd postfix perl

ok后我们开始进行openwebmail的实际安装过程:

第一步:

到http://www.openwebmail.org/openwebmail/download/处下载如下文件包:

openwebmail-2.53.tar.gz

1 CGI.pm-3.05.tar.gz

2 Text-Iconv-1.2.tar.gz

3 Digest-1.08.tar.gz

4 libiconv-1.9.1.tar.gz (非必须)

5 libnet-1.19.tar.gz

6 Digest-MD5-2.33.tar.gz

7 MIME-Base64-3.01.tar.gz

第二步:

分别对于他们进行编译安装:

[root@linux CGI.pm-3.05]# perl Makefile.PL

Checking if your kit is complete...

Looks good

Writing Makefile for CGI

[root@linux CGI.pm-3.05]# make; make install

Writing /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/CGI/.packlist

Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod

[root@linux openwebmail]# tar zvxf libnet-1.19.tar.gz

[root@linux openwebmail]# cd libnet-1.19

[root@linux libnet-1.19]# perl Makefile.PL

Checking for Socket...ok

Checking for IO::Socket...ok

Checking if your kit is complete...

Looks good

Ah, I see you already have installed libnet before.

Do you want to modify/update your configuration (y|n) ? [no] no

这里提示要不要对原有网络配置进行更新修改,我们选择no

This script will prompt you to enter hostnames that can be used as

defaults for some of the modules in the libnet distribution.

To ensure that you do not enter an invalid hostname, I can perform a

lookup on each hostname you enter. If your internet connection is via

a dialup line then you may not want me to perform these lookups, as

it will require you to be on-line.

Do you want me to perform hostname lookups (y|n) ? [yes]

The following questions all require a list of host names, separated

with spaces. If you do not have a host available for any of the

services, then enter a single space, followed by . To accept the

default, hit

Enter a list of available NNTP hosts : []

Enter a list of available SMTP hosts : []

Enter a list of available POP3 hosts : []

Enter a list of available SNPP hosts : []

Enter a list of available PH Hosts : []

Enter a list of available TIME Hosts : []

Enter a list of available DAYTIME Hosts : []

Do you have a firewall/ftp proxy between your machine and the internet

If you use a SOCKS firewall answer no

(y|n) ? [no]

Normally when FTP needs a data connection the client tells the server

a port to connect to, and the server initiates a connection to the client.

Some setups, in particular firewall setups, can/do not work using this

protocol. In these situations the client must make the connection to the

server, this is called a passive transfer.

Should all FTP connections be passive (y|n) ? [yes]

What is your local internet domain name : []

If you specified some default hosts above, it is possible for me to

do some basic tests when you run `make test'

This will cause `make test' to be quite a bit slower and, if your

internet connection is via dialup, will require you to be on-line

unless the hosts are local.

Do you want me to run these tests (y|n) ? [yes]

To allow Net::FTP to be tested I will need a hostname. This host

should allow anonymous access and have a /pub directory

What host can I use : []

Writing libnet.cfg

Writing Makefile for Net

make install:同样提示(目前看来是perl编译器有些问题,但不知道会不会对他有影响)

Writing /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Net/.packlist

Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod

同上安装Digest-MD5-2.33正常

同上安装MIME-Base64-3.01正常

同上安装Text-Iconv-1.2正常

同上安装Digest-1.08正常

安装:libiconv-1.9.1时,解压缩后进入libiconv-1.9.1目录,里面没有Makefile.PL文件。这时运行./configure进行编译检测。然后在make;make install。

第三步:

以上编译安装完成后开始安装openwebmail主文件包。

首先我们将openwebmail-2.53.tar.gz复制到/usr/local/www/中进行解压缩。

[root@linux www]# tar -zvxBpf openwebmail-2.53.tar.gz

后生成了cgi-bin 和data文件夹

运行cgi-bin/openwebmail/openwebmail-tool.pl --init进行安装

[root@linux www]# cgi-bin/openwebmail/openwebmail-tool.pl --init

它将提示你需要将dbm.conf文件进行修改:

Please change 'cgi-bin/openwebmail/etc/dbm.conf' from(实际上是在cgi-bin/openwebmail/openwebmail/etc/default/下面)

dbm_ext .db

dbmopen_ext none

dbmopen_haslock no

to修改为

dbm_ext .db

dbmopen_ext .db

dbmopen_haslock no

And execute 'cgi-bin/openwebmail/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.

照以上提示操作,将dbmopen_ext none改为 .db。(不用更改/default路径)

重新运行 cgi-bin/openwebmail/openwebmail-tool.pl --init

[root@linux www]# cgi-bin/openwebmail/openwebmail-tool.pl --init

creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/b2g ...done.

creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/g2b ...done.

creating db /usr/local/www/cgi-bin/openwebmail/etc/maps/lunar ...done.

Creating UTF-8 locales...

langconv ar_AE.CP1256 -> ar_AE.UTF-8

langconv ar_AE.ISO8859-6 -> ar_AE.UTF-8

langconv bg_BG.CP1251 -> bg_BG.UTF-8

langconv ca_ES.ISO8859-1 -> ca_ES.UTF-8

langconv cs_CZ.ISO8859-2 -> cs_CZ.UTF-8

langconv da_DK.ISO8859-1 -> da_DK.UTF-8

langconv de_DE.ISO8859-1 -> de_DE.UTF-8

langconv el_GR.ISO8859-7 -> el_GR.UTF-8

langconv en_US.ISO8859-1 -> en_US.UTF-8

langconv es_AR.ISO8859-1 -> es_AR.UTF-8

langconv fi_FI.ISO8859-1 -> fi_FI.UTF-8

langconv fr_FR.ISO8859-1 -> fr_FR.UTF-8

langconv he_IL.CP1255 -> he_IL.UTF-8

langconv hr_HR.ISO8859-2 -> hr_HR.UTF-8

langconv hu_HU.ISO8859-2 -> hu_HU.UTF-8

langconv id_ID.ISO8859-1 -> id_ID.UTF-8

langconv it_IT.ISO8859-1 -> it_IT.UTF-8

langconv ko_KR.eucKR -> ko_KR.UTF-8

langconv lt_LT.CP1257 -> lt_LT.UTF-8

langconv nl_NL.ISO8859-1 -> nl_NL.UTF-8

langconv no_NO.ISO8859-1 -> no_NO.UTF-8

langconv pl_PL.ISO8859-2 -> pl_PL.UTF-8

langconv pt_BR.ISO8859-1 -> pt_BR.UTF-8

langconv pt_PT.ISO8859-1 -> pt_PT.UTF-8

langconv ro_RO.ISO8859-2 -> ro_RO.UTF-8

langconv ru_RU.KOI8-R -> ru_RU.UTF-8

langconv sk_SK.ISO8859-2 -> sk_SK.UTF-8

langconv sl_SI.CP1250 -> sl_SI.UTF-8

langconv sr_CS.ISO8859-2 -> sr_CS.UTF-8

langconv sv_SE.ISO8859-1 -> sv_SE.UTF-8

langconv th_TH.TIS-620 -> th_TH.UTF-8

langconv tr_TR.ISO8859-9 -> tr_TR.UTF-8

langconv uk_UA.KOI8-U -> uk_UA.UTF-8

...done.

Welcome to the OpenWebMail!

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.18-164.15.1.el5 i686

Perl: 5.008008

WebMail: OpenWebMail 2.53 20080123

Send the site report?(Y/n) y

sending report...

Thank you.

OK,到现在为止它的安装告一段落。

现在打开浏览器中输入http://ip/cgi-bin/openwebmail/openwebmail.pl看看结果。假如无法正常显示网页,请继续向下看:

据我推断,首次安装openwebmail的朋友肯定会遇到问题。本人自己曾遇到过很多问题,要么编译错误,要么无法正常显示登录界面。要么就是登录验证失败等等等等............一大堆问题!下面你可以看看常见的问题及排除方法。

第四步:

常见问题排解:

1、安装过程中提示:

sending report...

Couldn't open SMTP servers 127.0.0.1 at port 25! at cgi-bin/openwebmail/openwebmail-tool.pl line 1520.

解决方法:

你需要检查postfix 或者sendmail有无正常安装并且正在运行。

无论是postfix 或者sendmail只要安装一个就好。我建议安装postfix 。

检查方法:netstat -tulnp |grep :25看是否有在运行。如果确认已经安装并在运行,则要检查你的防火墙策略,比如建议先清除掉防火墙所有规则再进行测试。

2、打开浏览器中输入http://ip/cgi-bin/openwebmail/openwebmail.pl并不能显示出登录窗口。

解决方法:

我们还要设置apache(httpd)对openwebmail的支持,也就是调试阶段。由于httpd.conf默认配置网页主目录为/var/www/html下面。因此我们需要配合这个设置,以便于httpd能够找到我们的openwebmail.pl文件:

方法有两种,任选其一(推荐方法1)

方法1、[root@linux www]# ln -s /usr/local/www/cgi-bin/ /var/www/ 建立一个连接到/var/www/

[root@linux www]# ln -s /usr/local/www/data/ /var/www/ 建立一个连接到/var/www/

方法2、更改/etc/httpd/conf/httpd.conf

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" 改为 ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"

改为

保存并退出,

进行/etc/init.d/httpd restart

此时我们应该能够正常打开openwebmail页面:在浏览器中输入http://ip/cgi-bin/openwebmail/openwebmail.pl显示出登录窗口。

3、没有正常显示图标。(很多朋友都会遇到图标显示问题)

解决方法:[root@linux www]# ln -s /usr/local/www/data/openwebmail/ /var/www/html/ 即可。

4、登录遇到的问题:

首先默认不能用root进行登录是正常的,我们新建或使用已经存在的其他用户进行登录 提示:

登录失败

认证系统内部错误,请回到登录页面 再试一次

解决方法:

修改 /usr/local/www/cgi-bin/openwebmail/etc/default/auth_unix.conf

passwdfile_plaintext /etc/passwd

passwdfile_encrypted /etc/master.passwd 修改为 passwdfile_encrypted /etc/shadow

passwdmkdb /usr/sbin/pwd_mkdb 修改为 passwdmkdb none

check_expire no

check_nologin no

check_shell no

check_cobaltuser no

change_smbpasswd no

保存退出。

本文作者:guozhanfeng govip#126.com 2010-08-14 beijing

5、发送邮件后,对方显示发件人主机不正常 :@后面不是我想要的域名

解决方法:

修改/usr/local/www/cgi-bin/openwebmail/etc/openwebmail.conf

domainnames auto #将auto修改为你的域名如:netren.org

auth_module auth_unix.pl

mailspooldir /var/mail

ow_cgidir /usr/local/www/cgi-bin/openwebmail

ow_cgiurl /cgi-bin/openwebmail

ow_htmldir /usr/local/www/data/openwebmail

ow_htmlurl /openwebmail

logfile /var/log/openwebmail.log

enable_viruscheck no

enable_spamcheck no

enable_learnspam no

default_iconset Default

default_fscharset none

<DEFAULT_SIGNATURE><DEFAULT_SIGNATURE>

--

Open WebMail Project (http://openwebmail.org) #此处为所有用户邮件的默认签名,你可以修改成你想要的内容。

<DEFAULT_SIGNATURE><DEFAULT_SIGNATURE>

基本上,现在你可以正常使用openwebmail系统了。

总结:linux下面安装openwebmail确实不是件容易的事情,但是不要恐惧。基本上遵循大的原则即可搞定:

一、所需套件必须编译安装正确

二、apache2(httpd)和postfix套件必须安装正确

三、它与php mysql无关

四、将openwebmail解压到正确的位置/usr/local/www/ 或 /var/www/(后者需要过多的调试配置文件)

五、按照一些说明配置好相关配置文件。

source: http://www.netren.org/index.php/jeffreyguo/43-openwebmail-centos.html