2012-09-25

Webmail (一) Horde webmail 安裝與設定

Webmail (一) Horde webmail 安裝與設定


簡介:

Horde 是個高效能的 Open Source 程式 , 基於 PHP , 不像 OpenWebMail 是採用 CGI 語法寫成 , 效能當然也比較優!
且支援許多方便的功能 , 如 待辦事項 , 備忘錄 , 行事曆... 等 , 其中的行事曆功能也不亞於 Google 的行事曆功能相當不錯! 更支援 檔案總管 功能 , 讓所有擁有Mail帳號的使用者可互相共享資料 , 省去 FTP 或是 Mail 傳來傳去的時間 , 常用的 通訊錄 也支援 windows 的 .cvs 檔 (OutLook 通訊錄檔) , 匯入匯出功能 , 更讓使用者省去許多建立通訊錄的時間 , Horde 真的是很貼心呢! 萬一使用者有任何問題要提報管理者 , 只需點右上角的 "問題" 的驚嘆號圖示 , 內容填一填 , 系統就直接發一封 Mail 到管理者的信箱 , 與管理者溝通更直接快速!
Horde 與 Google 一樣也支援許多佈景主題 , 提供使用者選擇 , 另外 , 使用者更可以自己排列自己的首頁 , 只需點上面工具列的 "版面配置" , 將許多常用的功能放在首頁 , 行事曆..備忘錄..待辦事項..信件..全部一目了然 , 這真的是太方便囉 , 這可是 OpenWebMail 辦不到的特異功能!
Horde 其實還有許多功能 , 目前止能點到為止 , 因為還不是很瞭解 Horde , 日後有新功能在慢慢補上囉~
注意事項:

在安裝 Horde 之前 , 必須先確認 CentOS 已經安裝設定好 Postfix , Dovecot , httpd(nginx) , DNS , 且都可以正常運作

環境:

CentOS 5.4 - 2.6.18-164.11.1.el5

安裝流程:

安裝必要元件 GD Linrary:

#yum install php-gd -y

修改 PHP memory_limit:
若記憶體允許 , 建議改成 128M

#vi /etc/php.ini
memory_limit = 64M

#/etc/init.d/httpd reload

修正 temporary bug (CentOS x86_64的bug):

#vi /etc/dovecot.conf
login_process_size = 64

#/etc/init.d/dovecot restart

啟動 & 設定 MySQL:
 啟動MySQL , 設定開機啟動

#/etc/init.d/mysql start
#chkconfig mysqld --on

第一次啟動 MySQL , 設定 root 密碼
#mysqladmin -u root password 'new-password'
#mysqladmin -u root -h yourhostname.yourdomain.com password 'new-password'

修改 MySQL 預設語系 latin 為 UTF-8

#vi /etc/my.cnf

[mysqld]
collation_server=utf8_general_ci
character_set_server=utf8
init_connect="SET NAMES 'utf8'"

[client]
default_character_set=utf8

#/etc/init.d/mysql restart

Apache 設定 Horde Virtual Host:
新增horde virtual host,並設定安全性設定

#vi /etc/httpd/conf.d/horde.conf

#
# Horde is a web application framework written in PHP.
#

Alias /horde /usr/share/horde

# Uncomment the following 3 lines to make Horde locally accessible only
#Order Deny,Allow
#Deny from all
#Allow from 127.0.0.1

Options +FollowSymLinks

# horde.org's recommended PHP settings:
php_admin_flag safe_mode off
php_admin_flag magic_quotes_runtime off
php_flag session.use_trans_sid off
php_flag session.auto_start off
php_admin_flag file_uploads on
# Optional - required for weather block in Horde to function
php_admin_flag allow_url_fopen on

# If horde dies while trying to handle large email file attachments,
# you are probably hitting PHP's memory limit. Raise that limit here,
# but use caution
# Set to your preference - memory_limit should be at least 32M
# and be greater than the value set for post_max_size
#php_value memory_limit 32M
#php_value post_max_size 20M
#php_value upload_max_filesize 10M

# /usr/share/pear is needed for PEAR. /var/www/html/horde is needed for Horde itself
# TODO: Set an appropriate include_path, too. Might even increase speed a bit.
php_admin_value open_basedir "/var/www/html/horde:/var/www/html/horde/config:/usr/share/pear:/tmp"
php_admin_flag register_globals off

Order Deny,Allow
Deny from all

# Deny access to files that are not served directly by the webserver

Order Deny,Allow
Deny from all

# Deny access to the test.php files except from localhost
#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#

安裝 phpMyAdmin:

下載新版 phpMyAdmin - http://www.phpmyadmin.net/home_page/downloads.php

建立 Admin 資料夾 , 將phpMyAdmin放進去

詳細步驟就不說明囉 , 很簡單

安裝 Horde:
使用 yum groupinstall 一口氣全部安裝

#yum groupinstall Horde

修改 Horde 專用的帳號與密碼

#cd /usr/share/horde/scripts/sql
#vi create.mysql.sql

REPLACE INTO user (host, user, password)
VALUES (
'localhost',
'horde',
-- IMPORTANT: Change this password!
PASSWORD('password')
);

測試支援度:
用test.php測試一下支援度 , 看看是否全部都支援 !

http://yourdomain.com.tw/horde/test.php

導入 Horde 各項 SQL 資料庫:
匯入 Horde 主資料庫

#cd /usr/share/horde/script/sql
#mysql -u root -p < create.mysql.sql

匯入kronolith行事曆table到horde

#cd /usr/share/horde/kronolith/scripts/sql
#mysql --user=root --password=? horde < kronolith.mysql.sql

匯入mnemo備忘錄table到horde

#cd /usr/share/horde/mnemo/scripts/sql
#mysql --user=root --password=? horde < mnemo.sql

匯入turba通訊錄table到horde

#cd /usr/share/horde/turba/scripts/sql
#mysql --user=root --password=? horde < turba.mysql.sql

匯入nag待辦事項table到horde

#cd /usr/share/horde/nag/scripts/sql
#mysql --user=root --password=? horde < nag.sql

設定 Horde 及其他:
建立 Log 記錄資料夾

#mkdir /var/log/horde
#chown apache:apache /var/log/horde

設定轉址檔index.php

#cd /var/www/html
#vi index.php

SunArt

FRAME
BORDER="no" BORDER=0 NORESIZE>

 Hored 設定

#vi /usr/share/horde/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: horde/config/conf.xml,v 1.74.2.48 2007/02/02 11:03:05 jan Exp $
$conf['debug_level'] = E_ALL;
$conf['max_exec_time'] = 0;
$conf['compress_pages'] = true;
$conf['umask'] = 077;
$conf['use_ssl'] = 2;
$conf['server']['name'] = $_SERVER['SERVER_NAME'];
$conf['server']['port'] = $_SERVER['SERVER_PORT'];
$conf['session']['name'] = 'Horde';
$conf['session']['use_only_cookies'] = true;
$conf['session']['cache_limiter'] = 'nocache';
$conf['session']['timeout'] = 0;
$conf['cookie']['domain'] = $_SERVER['SERVER_NAME'];
$conf['cookie']['path'] = '/horde';
$conf['sql']['persistent'] = false;
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = 'password';
$conf['sql']['protocol'] = 'unix';
$conf['sql']['database'] = 'horde';
$conf['sql']['charset'] = 'UTF-8';
$conf['sql']['phptype'] = 'mysql';
$conf['auth']['admins'] = array('jakson');
$conf['auth']['checkip'] = true;
$conf['auth']['checkbrowser'] = true;
$conf['auth']['alternate_login'] = false;
$conf['auth']['redirect_on_logout'] = false;
$conf['auth']['params']['app'] = 'imp';
$conf['auth']['driver'] = 'application';
$conf['signup']['allow'] = false;
$conf['log']['priority'] = PEAR_LOG_INFO;
$conf['log']['ident'] = 'HORDE';
$conf['log']['params'] = array();
$conf['log']['name'] = '/var/log/horde/horde.log';
$conf['log']['params']['append'] = true;
$conf['log']['type'] = 'file';
$conf['log']['enabled'] = true;
$conf['log_accesskeys'] = false;
$conf['prefs']['params']['table'] = 'horde_prefs';
$conf['prefs']['params']['driverconfig'] = 'horde';
$conf['prefs']['driver'] = 'sql';
$conf['datatree']['params']['table'] = 'horde_datatree';
$conf['datatree']['params']['table_attributes'] = 'horde_datatree_attributes';
$conf['datatree']['params']['driverconfig'] = 'horde';
$conf['datatree']['driver'] = 'sql';
$conf['group']['driver'] = 'datatree';
$conf['cache']['default_lifetime'] = 1800;
$conf['cache']['params']['dir'] = Horde::getTempDir();
$conf['cache']['params']['gc'] = 86400;
$conf['cache']['driver'] = 'file';
$conf['token']['params']['table'] = 'horde_tokens';
$conf['token']['params']['driverconfig'] = 'horde';
$conf['token']['driver'] = 'sql';
$conf['mailer']['params']['host'] = 'localhost';
$conf['mailer']['params']['port'] = 25;
$conf['mailer']['params']['localhost'] = 'localhost';
$conf['mailer']['params']['auth'] = '0';
$conf['mailer']['type'] = 'smtp';
$conf['vfs']['params']['persistent'] = false;
$conf['vfs']['params']['username'] = 'horde';
$conf['vfs']['params']['password'] = 'password';
$conf['vfs']['params']['protocol'] = 'unix';
$conf['vfs']['params']['database'] = 'horde';
$conf['vfs']['params']['charset'] = 'UTF-8';
$conf['vfs']['params']['phptype'] = 'mysql';
$conf['vfs']['params']['vfs_table'] = 'horde_vfs';
$conf['vfs']['params']['driverconfig'] = 'custom';
$conf['vfs']['type'] = 'sql';
$conf['sessionhandler']['params']['persistent'] = false;
$conf['sessionhandler']['params']['rowlocking'] = true;
$conf['sessionhandler']['params']['protocol'] = 'unix';
$conf['sessionhandler']['params']['hostspec'] = 'localhost';
$conf['sessionhandler']['params']['username'] = 'horde';
$conf['sessionhandler']['params']['password'] = 'password';
$conf['sessionhandler']['params']['database'] = 'horde';
$conf['sessionhandler']['params']['table'] = 'horde_sessionhandler';
$conf['sessionhandler']['type'] = 'mysql';
$conf['problems']['email'] = ' jakson@yourdomain.com.tw這個 E-mail 地址已經被防止灌水惡意程式保護,您需要啟用 Java Script 才能觀看 ';
$conf['problems']['maildomain'] = 'yourdomain.com.tw';
$conf['problems']['tickets'] = false;
$conf['menu']['apps'] = array('gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
$conf['menu']['always'] = false;
$conf['menu']['links']['help'] = 'all';
$conf['menu']['links']['help_about'] = true;
$conf['menu']['links']['options'] = 'authenticated';
$conf['menu']['links']['problem'] = 'all';
$conf['menu']['links']['login'] = 'all';
$conf['menu']['links']['logout'] = 'authenticated';
$conf['hooks']['permsdenied'] = false;
$conf['hooks']['username'] = false;
$conf['hooks']['preauthenticate'] = true;
$conf['hooks']['postauthenticate'] = false;
$conf['hooks']['authldap'] = false;
$conf['portal']['fixed_blocks'] = array();
$conf['accounts']['params']['quota_path'] = '/usr/bin/quota';
$conf['accounts']['params']['grep_path'] = '/bin/grep';
$conf['accounts']['params']['translateMountPoint'] = false;
$conf['accounts']['params']['translationTable'] = '/etc/mtab';
$conf['accounts']['driver'] = 'localhost';
$conf['imsp']['enabled'] = false;
$conf['kolab']['enabled'] = false;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

imp 設定

#vi /usr/share/horde/imp/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: imp/config/conf.xml,v 1.53.2.18 2007/05/03 15:24:51 chuck Exp $
$conf['utils']['gnupg_keyserver'] = array('pgp.mit.edu');
$conf['utils']['gnupg_timeout'] = '10';
$conf['utils']['openssl_binary'] = '/usr/bin/openssl';
$conf['menu']['apps'] = array('gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
$conf['user']['select_sentmail_folder'] = false;
$conf['user']['allow_resume_all_in_drafts'] = false;
$conf['user']['allow_folders'] = true;
$conf['user']['allow_resume_all'] = false;
$conf['user']['allow_view_source'] = true;
$conf['user']['alternate_login'] = false;
$conf['user']['redirect_on_logout'] = false;
$conf['server']['change_server'] = false;
$conf['server']['change_port'] = false;
$conf['server']['change_protocol'] = false;
$conf['server']['change_smtphost'] = false;
$conf['server']['change_smtpport'] = false;
$conf['server']['server_list'] = 'none';
$conf['server']['sort_limit'] = '0';
$conf['server']['cache_folders'] = false;
$conf['server']['cache_msgbody'] = false;
$conf['mailbox']['show_attachments'] = false;
$conf['mailbox']['show_preview'] = false;
$conf['mailbox']['show_xpriority'] = false;
$conf['fetchmail']['show_account_colors'] = false;
$conf['fetchmail']['size_limit'] = '12000000';
$conf['msgsettings']['filtering']['words'] = './config/filter.txt';
$conf['msgsettings']['filtering']['replacement'] = '****';
$conf['spam']['spamfolder'] = false;
$conf['spam']['bounce'] = 'DSPAM';
$conf['spam']['program'] = '/usr/local/bin/spamassassin -r';
$conf['spam']['reporting'] = true;
$conf['notspam']['reporting'] = false;
$conf['msg']['prepend_header'] = true;
$conf['msg']['append_trailer'] = true;
$conf['compose']['allow_cc'] = true;
$conf['compose']['allow_bcc'] = true;
$conf['compose']['allow_receipts'] = true;
$conf['compose']['special_characters'] = true;
$conf['compose']['use_vfs'] = false;
$conf['compose']['link_all_attachments'] = false;
$conf['compose']['link_attachments_notify'] = true;
$conf['compose']['link_attachments'] = true;
$conf['compose']['add_maildomain_to_unexpandable'] = false;
$conf['compose']['attach_size_limit'] = '0';
$conf['compose']['attach_count_limit'] = '0';
$conf['hooks']['vinfo'] = false;
$conf['hooks']['signature'] = false;
$conf['hooks']['trailer'] = false;
$conf['hooks']['fetchmail_filter'] = false;
$conf['hooks']['mbox_redirect'] = false;
$conf['hooks']['mbox_icon'] = false;
$conf['hooks']['spam_bounce'] = false;
$conf['maillog']['use_maillog'] = true;
$conf['tasklist']['use_tasklist'] = true;
$conf['notepad']['use_notepad'] = true;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

ingo 過濾器設定

#vi /usr/share/horde/ingo/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: ingo/config/conf.xml,v 1.13 2004/02/11 19:24:23 slusarz Exp $
$conf['menu']['apps'] = array( 'gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
$conf['storage']['driver'] = 'prefs';
$conf['storage']['maxblacklist'] = 0;
$conf['storage']['maxwhitelist'] = 0;
$conf['rules']['userheader'] = true;
$conf['rules']['usefolderapi'] = true;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

turba 通訊錄設定

#vi /usr/share/horde/turba/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: turba/config/conf.xml,v 1.6.2.3 2006/05/09 15:58:10 jan Exp $
$conf['menu']['import_export'] = true;
$conf['menu']['apps'] = array('gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
$conf['client']['addressbook'] = 'localsql';
$conf['comments']['allow'] = true;
$conf['documents']['params']['driverconfig'] = 'horde';
$conf['documents']['type'] = 'sql';
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

kronolith 行事曆設定

#vi /usr/share/horde/kronolith/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: kronolith/config/conf.xml,v 1.14.10.4 2006/02/08 12:27:31 jan Exp $
$conf['calendar']['params']['table'] = 'kronolith_events';
$conf['calendar']['params']['driverconfig'] = 'horde';
$conf['calendar']['driver'] = 'sql';
$conf['storage']['params']['table'] = 'kronolith_storage';
$conf['storage']['params']['driverconfig'] = 'horde';
$conf['storage']['driver'] = 'sql';
$conf['metadata']['keywords'] = false;
$conf['reminder']['server_name'] = 'yourdomain.com.tw';
$conf['reminder']['from_addr'] = 'yourdomain.com.tw';
$conf['autoshare']['shareperms'] = 'none';
$conf['menu']['print'] = true;
$conf['menu']['import_export'] = true;
$conf['menu']['apps'] = array('gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

gollem 檔案總管設定

#vi /usr/share/horde/gollem/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: gollem/config/conf.xml,v 1.5.2.2 2005/12/11 18:31:18 slusarz Exp $
$conf['manager']['date_format'] = '%x';
$conf['backend']['backend_list'] = 'hidden';
$conf['menu']['apps'] = array( 'gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'passwd', 'turba');
$conf['user']['alternate_login'] = false;
$conf['user']['redirect_on_logout'] = false;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

nag 待辦事項設定

#vi /usr/share/horde/nag/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: nag/config/conf.xml,v 1.25.10.1 2005/10/18 12:56:37 jan Exp $
$conf['storage']['params']['table'] = 'nag_tasks';
$conf['storage']['params']['driverconfig'] = 'horde';
$conf['storage']['driver'] = 'sql';
$conf['menu']['print'] = true;
$conf['menu']['import_export'] = true;
$conf['menu']['apps'] = array( 'gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

mnemo 備忘錄設定

#vi /usr/share/horde/mnemo/config/conf.php

/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Horde: mnemo/config/conf.xml,v 1.17 2004/10/03 13:07:37 stuart Exp $
$conf['storage']['params']['table'] = 'mnemo_memos';
$conf['storage']['params']['driverconfig'] = 'horde';
$conf['storage']['driver'] = 'sql';
$conf['menu']['print'] = true;
$conf['menu']['import_export'] = true;
$conf['menu']['apps'] = array( 'gollem', 'horde', 'imp', 'ingo', 'kronolith', 'mnemo', 'nag', 'turba');
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

安全性設定:
config 安全部分

#chown apache:root -R /var/www/html/horde/config
#chown apache:root -R /var/www/html/horde/*/config
#chmod -R go-rwx /var/www/html/horde/config
#chmod -R go-rwx /var/www/html/horde/*/config

script 安全部分

#chown -R root:root /var/www/html/horde/scripts
#chown -R root:root /var/www/html/horde/*/scripts
#chmod -R go-rwx /var/www/html/horde/scripts
#chmod -R go-rwx /var/www/html/horde/*/scripts

test.php 安全部分

#chmod a-rwx /var/www/html/horde/test.php
#chmod a-rwx /var/www/html/horde/*/test.php


完成與測試:

也可以使用 Webmail (二) OpenWebmail


※以上參考 - DNS,Samba,DHCP,IPTABLES,Postfix 架設全記錄

沒有留言:

張貼留言