架設 Roundcube

  1. 安裝 roundcubemail 套件。
    [root@mail ~]# yum install roundcubemail --enablerepo=remi
    
  2. 安裝 mysql-server 套件。
    [root@mail ~]# yum install mysql-server --enablerepo=remi
    
  3. 啟動 mysqld 服務。
    [root@mail ~]# /etc/init.d/mysqld start
    [root@mail ~]# chkconfig mysqld on
    
  4. 執行安全安裝設定,主要是設定 root 密碼。
    [root@mail ~]# mysql_secure_installation
    
  5. 登入 mysql 建立資料庫 roundcube 及用戶 ronudcube。
    [root@mail ~]# mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 6
    Server version: 5.5.49 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> CREATE DATABASE roundcube; 
    Query OK, 1 row affected (0.00 sec)
    
    mysql> GRANT ALL PRIVILEGES ON roundcube.* TO roundcube@localhost IDENTIFIED BY 'password';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    
  6. roundcube 的主網頁預設在 /usr/share/roundcubemail。
    [root@mail ~]# vim /etc/httpd/conf.d/roundcubemail.conf 
    [root@mail ~]# grep Alias /etc/httpd/conf.d/roundcubemail.conf 
    Alias /roundcubemail /usr/share/roundcubemail
    
  7. roundcube 預設只有本機可以連線安裝目錄,如果在遠端連線必須修改存取限制。
    [root@mail ~]# grep -A15 '<Directory.*installer' /etc/httpd/conf.d/roundcubemail.conf | grep -v '#'
    <Directory /usr/share/roundcubemail/installer/>
        <IfModule mod_authz_core.c>
            Require local
        </IfModule>
        <IfModule !mod_authz_core.c>
            Order Allow,Deny
            Allow from all
        </IfModule>
    </Directory>
    
  8. 連線 installer 測試系統是否滿足?
    https://webmail.csie.cyut.edu.tw/roundcubemail/installer/
    
  9. 測試顯示 mysql 資料庫不能便用,安裝 php-mysqlnd,重新啟動 mysqld 及 httpd 服務後顯示 mysql 資料已可使用。
    [root@mail ~]# yum install php-mysqlnd --enablerepo=remi
    [root@mail ~]# /etc/init.d/mysqld restart
    Stopping mysqld:                                           [  OK  ]
    Starting mysqld:                                           [  OK  ]
    [root@mail ~]# /etc/init.d/httpd restart
    Stopping httpd:                                            [  OK  ]
    Starting httpd:                                            [  OK  ]
    
  10. 再連線 installer 測試系統,mysql 資料已可以使用,依安裝網頁指引進行設定,重點是使用 mysql 資料庫,資料庫名稱、使用者及密碼必須與先前產生的一致。
    Image roundcubeinstaller
    Database name: 資料庫名稱
    Database user name: 資料庫使用者
    Database password: 資料庫密碼
    
  11. 設定好之後下載 config.inc.php 至 mail server 的 /etc/roundcubemail 目錄。安全起見,移除安裝目錄或將其設定成其他用戶無法存取。
    [root@mail roundcubemail]# chmod 700 installer/