Linux Webmail2 (RoundCube)
(2016.12.25)
Webmail (RoundCube) でブラウザからメールを読んだり書いたりする。yumでインストールできる。
(環境) CentOS 6, CentOS 5.9(Squirrelmail)はこちら
準備
rootで(以下プロンプトが#ならroot,$なら普通のユーザー)。
まず,SSL Webサーバ,IMAPサーバdovecot,データベースMysqlをそれぞれ以下のようにインストールする.
SSL,dovecot,mysql for wordpress
その後,
# yum install roundcubemail
データベース作成
以下のようにしてデータベースを作成して,
# mysql -u root -p
mysql> create database roundcubemail character set utf8 collate utf8_bin;
mysql> grant all on roundcubemail.* to roundcubemail@localhost identified by 'パスワード';
mysql> flush privileges;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| roundcube |
| test |
| wordpress |
+--------------------+
mysql> quit;
初期化する。
# mysql -p roundcubemail < /usr/share/roundcubemail/SQL/mysql.initial.sql
Enter password: 上で設定したパスワード
Apache設定
roundcubemailのapache設定ファイルを外部からアクセスできるように修正する。太字部分。
# vi /etc/httpd/conf.d/roundcubemail.conf
#
# Round Cube Webmail is a browser-based multilingual IMAP client
#
Alias /roundcubemail /usr/share/roundcubemail
# Define who can access the Webmail
# You can enlarge permissions once configured
<Directory /usr/share/roundcubemail/>
<IfModule mod_authz_core.c>
# Apache 2.4
# Require local
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from all
# Allow from 127.0.0.1
# Allow from ::1
Allow from all
</IfModule>
</Directory>
# Define who can access the installer
# keep this secured once configured
<Directory /usr/share/roundcubemail/installer/>
<IfModule mod_authz_core.c>
# Apache 2.4
# Require local
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from all
# Allow from 127.0.0.1
# Allow from ::1
Allow from all
</IfModule>
</Directory>
設定を反映させるために,apacheを再起動。
# service httpd restart
設定
そしてブラウザから http://ホスト名/roundcubemail/installer/にアクセスする。
Check environmentがOKなら[NEXT]をクリック。
Create configで,設定を入力する。最低限必要なのは「Database setup」の項目のDB Type,サーバ名,アクセスする際のユーザ名,パスワードなど。入力が完了したらcreate configボタンをクリック。
設定ファイルが作成されるので,コピーしてconfig.inc.phpファイルを/etc/roundcubemailに設置する。パーミッションはdefaults.inc.phpと同じにする。そしてcontinueボタンをクリック。
installerは不要なので,安全のため,/usr/share/roundcubemail/installer/ の名前を変えておく。
細かい設定は/etc/roundcubemail/defaults.inc.phpに対して行う。
SSL
SSLでのアクセスしか許可しないように設定。
# vi /var/www/roundcubemail/config/defaults.inc.php
で以下を追加
$config['force_https'] = true;
利用開始
ブラウザから http://ホスト名/roundcubemail/installer/にアクセスして色々設定。ログインユーザ名はimapのユーザー名。