作者:朱國光 IMP 3.1在Red Hat 8.0的安裝 安裝預設環境: 機器名稱 webmail.example.com 網域 example.com SMTP 服務器 mail.example.com IMAP服務器 WU-IMAP 2001a IMAP主機 mail.example.com IMAP資料夾 ~/mail/ SQL 服務器 mysql SQL 主機 localhost 軟件版本: RedHat 8.0 Horde 2.1 IMP 3.1 Turba 1.1 Pear 4.1.0 (自horde.org取得) 內建RedHat8.0服務器版本: apache-2.0.40 PHP-4.2.2-8.0.5php-imap-4.2.2-8.0.5php-ldap-4.2.2-8.0.5php-mysql-4.2.2-8.0.5 mysql-server-3.23.52-3mysql-3.23.52-3 imap-2001a-15 sendmail-8.12.5-7 1. 修改php的組態設定 etc/php.ini short_open_tag = Onupload_max_filesize=3M #設定上傳檔案大小上限 2. 增加Apache中 horde虛擬目錄 /etc/httpd/conf/httpd.conf Alias /horde /var/www/Html/mail/horde/ Alias /horde/ /var/www/html/mail/horde/ 3. 下載及安裝Horde # cd /tmp # wget -c --passive-FTP ftp://ftp.horde.org/pub/horde/tarballs/horde-2.1.tar.gz # tar xzf horde-2.1.tar.gz -C /var/www/html/mail # cd /var/www/html/mail # mv horde-2.1 horde 4. 下載及安裝Pear # cd /usr/share # mv pear pear.4.1.2.redhat # cd /tmp # wget -c --passive-ftp ftp://ftp.horde.org/pub/horde/tarballs/pear-4.1.0.tar.gz # tar xzf pear-4.1.0.tar.gz -C /usr/share # cd /usr/share # mv pear-4.1.0 pear # chown root.root -R pear 每當重新更新 php rpms時必須重新執行一次 5. 設定mysql組態 確定mysql正常激活 # service mysqld restart 建立Horde數據庫 # cd horde/scripts/db # vi mysql_create.sql # >>>重要<<< 請修改預設密碼 # mysql < mysql_create.sql # 建table 測試聯機數據庫 # mysql -h localhost -D horde -u horde -p 輸入'exit'離開數據庫 6. 將Horde散布檔復制為預設組態檔 # cd horde/config # for foo in *.dist; do cp -v $foo `basename $foo .dist`; done 7. 修改horde數據庫設定 /horde/config/horde.php // use IMAP to authenticate users$conf['auth']['driver'] = 'imap';$conf['auth']['params']['dsn'] = '{mail.example.com.tw/imap:143}INBOX';// use MySQL to store Horde Stuff$conf['prefs']['driver'] = 'sql';$conf['prefs']['params']['phptype'] = 'mysql';$conf['prefs']['params']['hostspec'] = 'localhost';$conf['prefs']['params']['username'] = 'horde';$conf['prefs']['params']['passWord'] = '******'; /* <- edit this line */$conf['prefs']['params']['database'] = 'horde';$conf['prefs']['params']['table'] = 'horde_prefs';// the sendmail, not SMTP, to send emails$conf['mailer']['type'] = 'sendmail' 8. 增加信賴使用者 /etc/mail/trusted-users apache 9. 設定horde預設語系 /horde/config/lang.php // look down for the list of aliases$nls['defaults']['language'] = 'zh_TW';$nls['defaults']['charset'] = 'BIG5'; 10. 測試horde是否安裝完成 http://webmail.example.com/horde/test.php 11. 下載及安裝IMP # cd /tmp # wget -c --passive-ftp ftp://ftp.horde.org/pub/imp/tarballs/imp-3.1.tar.gz # tar xzf imp-3.1.tar.gz -C /var/www/html/mail/horde # cd /var/www/html/mail/horde # mv imp-3.1 imp 12. 修改登錄檔 /horde/config/registry.php // uncoment the folowing$this->registry['auth']['login'] = 'imp';$this->registry['auth']['logout'] = 'imp';// uncoment the folowing$this->applications['imp'] = array( 'fileroot' => dirname(__FILE__) . '/../imp', 'webroot' => $this->applications['horde']['webroot'] . '/imp', 'icon' => $this->applications['horde']['webroot'] . '/imp/graphics/imp.gif', 'name' => _("Mail"), 'allow_guests' => false, 'show' => true); $this->applications['horde'] = array('fileroot' => dirname(__FILE__) . '/..','webroot' => '/horde','initial_page' => 'login.php','icon' => '/horde/graphics/home.gif','name' => _("XX學校網絡郵局"),'allow_guests' => true,'show' => true,'templates' => dirname(__FILE__) . '/../templates','cookie_domain' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],'cookie_path' => '/horde','server_name' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],'server_port' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_PORT']); 13. 將IMP散布檔復制為預設組態檔 # cd horde/imp/config # for foo in *.dist; do cp -v $foo `basename $foo .dist`; done 14. 修改服務器地址設定 /horde/imp/config/servers.php // edit this lines$servers['imap'] = array( 'name' => 'IMAP Server', 'server' => 'mail.example.com.tw', 'protocol' => 'imap/notls', 'port' => 143, 'folders' => 'mail/', 'namespace' => '', 'maildomain' => 'example.com', 'smtphost' => 'mail.example.com', 'realm' => '', 'preferred' => 'true'); 15. 修改IMP預設設定值 /horde/imp/config/prefs.php // user language// look at /horde/config/lang.php for language aliases$_prefs['language'] = array( 'value' => 'zh_TW', 'locked' => false, 'shared' => true, 'type' => 'select', 'desc' => _("Select your preferred language:"));// user default mailbox// the default inbox canot be changed$_prefs['mailbox'] = array( 'value' => 'INBOX', 'locked' => true, 'shared' => false, 'type' => 'implicit');// use IMAP subscribe?// show only folders subscribed by IMAP$_prefs['subscribe'] = array( 'value' => 1, 'locked' => true, 'shared' => false, 'type' => 'checkbox', 'desc' => _("Use IMAP folder subscriptions")); 17. 測試IMP是否成功 http://webmail.example.com/horde/imp/test.php 18. 下載及安裝Turba # cd /tmp # wget -c --passive-ftp ftp://ftp.horde.org/pub/turba/tarballs/turba-1.1.tar.gz # tar xzf turba-1.1.tar.gz -C /var/www/html/mail/horde # cd /var/www/html/mail/horde # mv turba-1.1 turba 19. 將Turba散布檔復制為預設組態檔 # cd horde/turba/config # for foo in *.dist; do cp -v $foo `basename $foo .dist`; done 20. 修改horde登錄檔加入turba /horde/config/registry.php // uncoment this$this->applications['turba'] = array( 'fileroot' => dirname(__FILE__) . '/../turba', 'webroot' => $this->applications['horde']['webroot'] . '/turba', 'icon' => $this->applications['horde']['webroot'] . '/turba/graphics/turba.gif', 'name' => _("Addressbook"), 'allow_guests' => false, 'show' => true); 21. 以下修改設定檔 /horde/imp/config/conf.php $conf['menu']['apps'] = array('turba'); /horde/turba/config/conf.php $conf['menu']['apps'] = array('imp'); 22. 修改turba預設語系 /horde/turba/config/prefs.php // user language// set the same default language as Horde and IMP$_prefs['language'] = array( 'value' => 'zh_TW', 'locked' => false, 'shared' => true, 'type' => 'select', 'desc' => _("Select your preferred language:")); 23. 修改turba存取SQL密碼 /horde/turba/config/sources.php // complete this part of the config with the data// of the database as in /horde/config/horde.php// Also config the title to a know name in your locale$cfgSources['localsql'] = array( 'title' => 'My Addressbook', 'type' => 'sql', 'params' => array( 'phptype' => 'mysql', 'hostspec' => 'localhost', 'username' => 'horde', 'password' => '******', /*Edit this line!!!*/ 'database' => 'horde', 'table' => 'turba_objects' ), 24. 加入truba資料至SQL服務器數據庫中 # cd /horde/turba/scripts/drivers/ # mysql < turba.sql 若mysql的root有設密碼,請以輸入方式輸入密碼******增加資料 # mysql -u root -p****** < turba.sql 25. 增加信件上可直接看到網頁功能 horde/imp/config/mine_drivers.php /** * HTML driver settings */ $mime_drivers['imp']['html']['inline'] = true; $mime_drivers['imp']['html']['icons'] = array( 'default' => 'html.gif' ); $mime_drivers['imp']['html']['handles'] = array( 'text/html', 'text/richtext' ); 26. 修改預設mysql root密碼 #mysql mysql >update user set passowrd=password('******') where user='root'; >flush privileges; >exit 27. 修改由信件由smtp服務器送信 horde/config/horde.php $conf['mailer']['type'] = 'smtp'; $conf['mailer']['params'] = array(); $conf['mailer']['params'] = array('server' => 'smtp.example.com'); $conf['mailer']['params'] = array('port' => '25'); 28. 測試全部是否正常: http://webmail.example.com/horde/ 其它安全注意事項: 一、Upgrade Red Hat相關patch, 如使用up2date或Autorpm 二、設定防火牆 三、關閉不必要的服務 參考資料: http://www.horde.org/imp http://www.geocities.com/oliversl/imp