2012年7月28日 星期六

centos5安裝openwebmail2.5.3

文轉http://ahsien2009.wordpress.com/2009/05/21/centos-5%E5%AE%89%E8%A3%9Dopenwebmail/

先取得yum的openwebmail位置並放置在/etc/yum.repos.d/ :

# cd /etc/yum.repos.d
# wget http://www.openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo

安裝perl-Text-Iconv:
#rpm -ivh http://apt.sw.be/redhat/el5/en/i386/dag/RPMS/perl-Text-Iconv-1.4-1.2.el5.rf.i386.rpm

yum方式安裝openwebmail-data:
#yum -y install openwebmail-data
#yum -y install perl-suidperl perl-Compress-Zlib 
# yum -y install openwebmail

修改openwebmail.conf
#cp /var/www/cgi-bin/openwebmail/etc/openwebmail.conf /var/www/cgi-bin/openwebmail/etc/openwebmail.conf.bak
#vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
57行 enable_pop3 yes 修改成--> enable_pop3 no
64行 default_language en 修改成--> default_language zh_TW.Big5
76行~81
87行 default_iconset Cool3D.English 修改成--> default_iconset Cool3D.Chinese.Traditional
204行 webdisk_rootpath /webdisk 修改成--> webdisk_rootpath /

修改 dbm.conf
#cp /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf.bak

#vi /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
最後第二行
dbmopen_ext none 改
dbmopen_ext .db

#cp /var/www/cgi-bin/openwebmail/etc/dbm.conf /var/www/cgi-bin/openwebmail/etc/dbm.conf.bak
#vi /var/www/cgi-bin/openwebmail/etc/dbm.conf
最後三行改成如下:

dbm_ext                 .pag
dbmopen_ext             none
dbmopen_haslock         yes

初始化
#/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init

縮短 Open WebMail 連結網址:
在設定檔最後面加上這一行
vi /etc/httpd/conf/httpd.conf

ScriptAlias / "/var/www/cgi-bin/openwebmail/openwebmail.pl"

#/etc/rc.d/init.d/httpd restart

*如果centos開啟SELinux時需另作以下設定
否開啟openwebmail會出現無法寫入 /var/log/openwebmail.log! (Permission denied)錯誤
#chcon -u system_u /var/log/openwebmail.log
#chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
#chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail*
*說明
chcon -u system_u /var/log/openwebmail.log <==這是修改檔案使用者權限
chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log <==這是修改寫入權限

chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail* <==這是修改檔案由什麼套件專用

最後測試
http://IP/ 即可開openwebmail