Debian 10 Buster
Sponsored Link

Apache2 : Webメール RoundCube2019/08/09

 
RoundCube をインストールして Web メールシステムを構築します。
当例では以下のような環境で、メールサーバーは同一 LAN 内の別ホストを利用するように設定します。
またバックエンドでデータベースを使用するため、MySQL, SQLite, PostgreSQL のいずれかがインストール済みである必要があります。 当例では MySQL 互換の MariaDB を利用するよう設定します。
+----------------------+          |          +----------------------+
|  [  www.srv.world  ] |10.0.0.31 | 10.0.0.32|  [ mail.srv.world  ] |
|     Apache httpd     +----------+----------+        Postfix       |
|      (Roundcube)     |                     |        Dovecot       |
|       MariaDB        |                     |                      |
+----------------------+                     +----------------------+

[1]
[2]
[3]
[4]
[5]
[6] RoundCube 用のデータベースを作成しておきます。
root@www:~#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 104
Server version: 10.3.15-MariaDB-1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# [roundcube] データベース作成 ('password'の箇所は設定したいパスワードに置き換え)

MariaDB [(none)]>
create database roundcube;

Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on roundcube.* to roundcube@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
exit

Bye
[7] RoundCube のインストールと設定です。
root@www:~#
apt -y install roundcube roundcube-mysql
# データベースの設定は後ほど手動実行するため [No] で OK

 +----------------------+ Configuring roundcube-core +-----------------------+
 |                                                                           |
 | The roundcube package must have a database installed and configured       |
 | before it can be used.  This can be optionally handled with               |
 | dbconfig-common.                                                          |
 |                                                                           |
 | If you are an advanced database administrator and know that you want to   |
 | perform this configuration manually, or if your database has already      |
 | been installed and configured, you should refuse this option.  Details    |
 | on what needs to be done should most likely be provided in                |
 | /usr/share/doc/roundcube.                                                 |
 |                                                                           |
 | Otherwise, you should probably choose this option.                        |
 |                                                                           |
 | Configure database for roundcube with dbconfig-common?                    |
 |                                                                           |
 |                    <Yes>                       <No>                       |
 |                                                                           |
 +---------------------------------------------------------------------------+

root@www:~#
cd /usr/share/dbconfig-common/data/roundcube/install

root@www:/usr/share/dbconfig-common/data/roundcube/install#
mysql -u roundcube -D roundcube -p < mysql

Enter password:  
# MariaDB roundcube パスワード

root@www:/usr/share/dbconfig-common/data/roundcube/install#
root@www:~#
vi /etc/roundcube/debian-db.php
# データベース情報を設定

$dbuser='
roundcube
';
$dbpass='
password
';
$basepath='';
$dbname='
roundcube
';
$dbserver='localhost';
$dbport='3306';
$dbtype='
mysql
';
root@www:~#
vi /etc/roundcube/config.inc.php
# 35行目:IMAPサーバーを指定 (STARTTLS接続)

$config['default_host'] = 'tls://mail.srv.world';
# 47行目:SMTPサーバーを指定 (STARTTLS接続)

$config['smtp_server'] = 'tls://mail.srv.world';
# 51行目:SMTPポート変更 (STARTTLS接続)

$config['smtp_port'] = 587;
# 55行目:変更 (SMTP認証にIMAP認証と同じユーザーを利用)

$config['smtp_user'] = '%u';
# 59行目:変更 (SMTP認証にIMAP認証と同じパスワードを利用)

$config['smtp_pass'] = '%p';
# 66行目:変更 (表示画面のタイトル)

$config['product_name'] = 'Server World Webmail';
# 最終行に追記

# IMAPポート指定 (STARTTLS接続)
$config['default_port'] = 143;

# SMTP認証タイプを指定
$config['smtp_auth_type'] = 'LOGIN';

# SMTP HELO host を指定
$config['smtp_helo_host'] = 'mail.srv.world';

# ドメイン名を指定
$config['mail_domain'] = 'srv.world';

# UserAgent を指定
$config['useragent'] = 'Server World Webmail';

# SMTP と IMAP の接続オプションを指定
$config['imap_conn_options'] = array(
  'ssl'         => array(
    'verify_peer' => true,
    'CN_match' => 'srv.world',
    'allow_self_signed' => true,
    'ciphers' => 'HIGH:!SSLv2:!SSLv3',
  ),
);
$config['smtp_conn_options'] = array(
  'ssl'         => array(
    'verify_peer' => true,
    'CN_match' => 'srv.world',
    'allow_self_signed' => true,
    'ciphers' => 'HIGH:!SSLv2:!SSLv3',
  ),
);

root@www:~#
vi /etc/apache2/conf-enabled/roundcube.conf
# 3行目:コメント解除

Alias /roundcube /var/lib/roundcube
# 11行目:必要であればアクセス許可変更

Require ip 127.0.0.1 10.0.0.0/24
root@www:~#
systemctl restart apache2
[8] アクセス許可したネットワーク内の任意のクライアントPC で Web ブラウザを起動し、[https://(サーバーのホスト名またはIPアドレス)/roundcube/] にアクセスします。 すると RoundCube のログイン画面が表示されるので、メールサーバー側に登録済みの任意のユーザーでログインします。 なお、以下の画面例は英語表示ですが、日本語 OS でアクセスすれば問題なく日本語表示されます。
[9] ログインできました。メールを送受信テストを実施して問題ないか確認してください。
関連コンテンツ