Fedora 27
Sponsored Link

Webメールシステム : RoundCube2017/12/26

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

[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 14
Server version: 10.2.9-MariaDB-log MariaDB Server

Copyright (c) 2000, 2017, 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 ~]#
dnf -y install roundcubemail
[root@www ~]#
cd /usr/share/roundcubemail/SQL

[root@www SQL]#
mysql -u roundcube -D roundcube -p < mysql.initial.sql

Enter password:  
# MariaDB roundcube パスワード

[root@www SQL]#
[root@www ~]#
cp -p /etc/roundcubemail/defaults.inc.php /etc/roundcubemail/config.inc.php

[root@www ~]#
vi /etc/roundcubemail/config.inc.php
# 28行目:以下のように変更 ('password'の箇所はroundcubeに設定したパスワード)

$config['db_dsnw'] = 'mysql://roundcube:
password
@localhost/
roundcube
';
# 74行目:ログの日付形式を [年-月-日 時:分:秒] に変更

$config['log_date_format'] = '
Y-M-d H:i:s O
';
# 138行目:IMAPサーバーを指定

$config['default_host'] = '
mail.srv.world
';
# 254行目:SMTPサーバーを指定

$config['smtp_server'] = '
mail.srv.world
';
# 262行目:変更 ( SMTP認証にIMAP認証と同じユーザー名を使用 )

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

$config['smtp_pass'] = '
%p
';
# 270行目:変更 ( SMTP認証タイプ )

$config['smtp_auth_type'] = '
LOGIN
';
# 282行目:SMTP HELO host を指定

$config['smtp_helo_host'] = '
mail.srv.world
';
# 514行目:ドメインを指定

$config['mail_domain'] = '
srv.world
';
# 544行目:表示画面のタイトルを変更

$config['product_name'] = '
Server World Webmail
';
# 547行目:UserAgent変更

$config['useragent'] = '
Server World Webmail
';
# 676行目:言語変更

$config['language'] =
ja_JP
;
# 1032行目:デフォルト文字セット変更

$config['default_charset'] = '
iso-2022-jp
';
[root@www ~]#
vi /etc/httpd/conf.d/roundcubemail.conf
# 14行目:アクセス許可IP追記

Require ip 10.0.0.0/24
[root@www ~]#
systemctl restart httpd

[8] SELinux を有効にしている場合は、ポリシーの許可設定が必要です。
[root@www ~]#
setsebool -P httpd_can_network_connect on

[9] 任意のクライアントコンピュータで Web ブラウザを起動し、[https://(サーバーのホスト名またはIPアドレス)/roundcubemail/] にアクセスします。 すると以下のようにログイン画面になるのでユーザー名とパスワードを入力してログインします。
[10] ログインできました。メールの送受信を実行し、正常に動作するか確認してください。
関連コンテンツ