寫下紀錄這是最近所安裝的東西,要如何在 CentOS 5.4 Linux 中安裝 Postfix + Roundcube Ajax Webmail ?
1. 安裝 Postfix + Dovecot
# netstat -nutlp |grep 25 # 查看原本 25 port 服務預設都是 sendmail
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2098/sendmail: acce
udp 0 0 fe80::250:4ff:fec3:7d59:123 :::* 2403/ntpd
# service sendmail stop
正在關閉 sm-client: [ 確定 ]
正在關閉 sendmail: [ 確定 ]
# chkconfig sendmail off # 關閉 sendmail
# chkconfig sendmail --list # 查看是否關閉
sendmail 0:關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉
# yum -y install postfix # 安裝另一套 Mail Transfer Agent (MTA) postfix
# vi /etc/postfix/main.cf # 設定 postfix 主設定檔
myhostname = mail.xxx.com.tw # 設定本機的 host name
mydomain = xxx.com.tw # 設定 domain 網域
mynetworks = 10.99.99.0/24, 127.0.0.0/8 # 設定幫忙可 relay 的 hosts
inet_interfaces = all # 設定服務 interface
#inet_interfaces = localhost #這一行加上# 號才能對外做 SMTP 服務
mydestination = xxx.com.tw # 設定本機要接收的 mail, 同 sendmail 的 local-host-names
home_mailbox = Maildir/ # 開啟使用 Maildor 格式
# postalias hash:/etc/aliases # 建立 aliases db
# postmap hash:/etc/postfix/access # 建立 access db
# alternatives --config mta # 更改系統 MTA
有 2 程式提供 'mta'。
選擇 指令
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
請輸入以保留目前的選擇[+],或輸入選擇號碼: 2
# chkconfig postfix on # 設定開機啟動 postfix
# chkconfig postfix --list # 查看開機啟動 postfix
# yum -y install dovecot # 安裝 dovecot
# vi /etc/dovecot.conf # 設定 dovecot
mail_location = maildir:~/Maildir
pop3_uidl_format = %08Xu%08Xv
# Required on x86_64 kernels
login_process_size = 64
# chkconfig dovecot on # 設定開機啟動 dovecot
# chkconfig dovecot --list # 查看開機啟動 dovecot
# service dovecot start # 手動啟動 dovecot
tcp 0 0 :::995 :::* LISTEN 16023/dovecot
tcp 0 0 :::110 :::* LISTEN 16023/dovecot
tcp 0 0 :::143 :::* LISTEN 16023/dovecot
# chown jim.jim /home/jim/Maildir # 修改擁有者
2. 升級 PHP 到 5.2.x 版之後版本
※ 這是因為我安裝的roundcube1.3.1版要求的,而原本 CentOS 5.4 中 yum 所裝的PHP為5.1.6版
# vi /etc/yum.repos.d/CentOS-Base.repo # 新增測試版 Server 套件庫
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/5/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
# php -v # 查看升級後版本
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
php-mysql-5.2.10-1.el5.centos
php-pecl-Fileinfo-1.0.4-3.el5.centos
php-mcrypt-5.2.9-2.el5.centos.3
php-xml-5.2.10-1.el5.centos
php-gd-5.2.10-1.el5.centos
php-mbstring-5.2.10-1.el5.centos
※ 到官網http://www.roundcube.net下載最新版本 roundcubemail-0.3.1.tar.gz 套件到 Server 的 /var/www/html 中
# cd /var/www/html # 切換目錄
# tar -xzvf roundcubemail-0.3.1.tar.gz # 解壓縮套件
# mv roundcubemail-0.3.1 webmail # 更改目錄名稱
# cd /var/www/html/webmail # 切換目錄
# chown -R apache.apache logs temp # 更改兩個目錄擁有者
# chmod 0700 logs temp # 更改兩個目錄權限
# mysql -p # 進入 mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 163
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
# cd /var/www/html/webmail/SQL/ # 切換目錄
# mysql -u roundcubemail -p -h localhost roundcubemail < mysql.initial.sql # 建立資料庫 roundcubemail 的 table
# cp db.inc.php.dist db.inc.php # copy DB 設定檔
# cp main.inc.php.dist main.inc.php # copy 主設定檔
//$rcmail_config['db_dsnw'] = ‘mysql://帳號:密碼@localhost/資料庫名稱; # 格式如左
# vi main.inc.php # 修改主要設定檔
$rcmail_config['default_host'] = '10.99.99.8'; #郵件伺服器的位置或DNS名稱
$rcmail_config['mail_domain'] = 'xxx.com.tw'; #網域名稱
$rcmail_config['smtp_server'] = '10.99.99.8'; #郵件伺服器的位置或DNS名稱
$rcmail_config['auto_create_user'] = true; # 自動 create user
$rcmail_config['create_default_folders'] = TRUE; # 建立預設資料夾
$rcmail_config['language'] = ' zh_TW '; # 預設語系
$rcmail_config['timezone'] = '8'; # 時區台灣是8
$rcmail_config['default_charset'] = 'UTF-8'; # 預設編碼
http://Your-IP/webmail/installer # 開個 Browse 查看安裝 roundcube 還缺哪些套件
# rm -rf /var/www/html/webmail/installer # 如果完成安裝,為安全理由請移除安裝目錄
http://Your-IP/webmail/ # 整個安裝完成後使用帳號登入
Ref:
http://wiki.centos.org/HowTos/postfix
http://www.roundcube.net
Add:
http://www.linuxmail.info/poppassd-setup-howto-centos-5/ # 安裝 poppassd 修改密碼 Plugin 外掛方式
※ roundcube 中通訊錄匯出時為 UTF-8 編碼,若要轉為 Outlook 看得懂得格式請先用記事本將 rcube_contacts.vcf 轉存成 ANSI 編碼後再匯入。


0 意見:
張貼意見