Roundcube

提供: ArchWiki
ナビゲーションに移動 検索に移動

Roundcube は機能豊富な PHP によるウェブベースのメールクライアントです。

インストール

roundcubemail パッケージをインストールしてください。さらにデータベース (MariaDB など) と PHP が動作するウェブサーバー (Apache HTTP Server など) が必要です。

設定

データベース

MariaDB

以下は MariaDB を使って Roundcube のデータベースをセットアップする例です。データベースの名前は roundcubemail で、ユーザーは roundcube でパスワードは password とします:

$ mysql -u root -p
CREATE DATABASE roundcubemail;
GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost' IDENTIFIED BY 'password';

使用するデータベースに関係なく、最初に roundcubemail のデータベーステーブルを初期化する必要があります。MariaDB の場合:

$ mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/SQL/mysql.initial.sql

SQLite

SQLite のデータベースは Roundcube によって自動的に作成されます。設定ファイルに指定したディレクトリが basedir に含まれていることを確認してください。/var/lib/roundcubemail を定義に追加して、ディレクトリを作成、所有者を http にすると良いでしょう。

他のデータベース

Roundcubemail には MS SQL, Oracle, PostgreSQL のインストールスクリプトが存在します。

Roundcube

サンプル設定ファイルをコピーして必要に応じて修正してください:

# cp /etc/webapps/roundcubemail/config/config.inc.php.sample /etc/webapps/roundcubemail/config/config.inc.php

メールサーバーの設定を行って、enable_installer を設定してセットアップウィザードを有効化してください:

/etc/webapps/roundcubemail/config/config.inc.php
$config['db_dsnw'] = 'mysql://roundcube:****@localhost/roundcubemail';
$config['default_host'] = 'tls://localhost'; // IMAP host
$config['smtp_server'] = 'tls://localhost';
$config['smtp_port'] = 587;
$config['des_key'] = 'some_awesome_long_semi_random_string';
$config['enable_installer'] = true;

PHP

PHP の設定で以下の変数を設定してください:

/etc/php/php.ini
date.timezone = "UTC"

そして以下の行をアンコメントしてください:

extension=iconv.so

php.iniopen_basedir を設定している場合、PHP から Roundcube のファイルが開けるように /etc/webapps/usr/share/webapps が含まれていることを確認してください。open_basedir を無効化・コメントアウトしている場合 (デフォルト設定)、何もする必要はありません。

ウェブサーバー

Apache

Apache の設定を設定ディレクトリにコピーしてください:

# cp /etc/webapps/roundcubemail/apache.conf /etc/httpd/conf/extra/roundcube.conf

そして以下の行を追加してください:

/etc/httpd/conf/httpd.conf
Include conf/extra/roundcube.conf

その後 Apache (httpd.service) を再起動してください。

Nginx

ノート:
  • 以下はサブディレクトリで Roundcube を実行する設定例です。
  • 以下の設定は php-fpm が動作するように nginx サーバーを設定していることが前提です。

Roundcube の location ブロックを追加してください:

/etc/nginx.conf
location /webmail {
        alias /usr/share/webapps/roundcubemail;
        access_log /var/log/nginx/roundcube_access.log;
        error_log /var/log/nginx/roundcube_error.log;
        # Favicon
        location ~ ^/webmail/favicon.ico$ {
                root /usr/share/webapps/roundcubemail/skins/classic/images;
                log_not_found off;
                access_log off;
                expires max;
        }
        # Robots file
        location ~ ^/webmail/robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
        # Deny Protected directories 
        location ~ ^/webmail/(config|temp|logs)/ {
                 deny all;
        }
        location ~ ^/webmail/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
                deny all;
        }
        location ~ ^/webmail/(bin|SQL)/ {
                deny all;
        }
        # Hide .md files
        location ~ ^/webmail/(.+\.md)$ {
                deny all;
        }
        # Hide all dot files
        location ~ ^/webmail/\. {
                deny all;
                access_log off;
                log_not_found off;
        }
        #Roundcube fastcgi config
        location ~ /webmail(/.*\.php)$ {
                include fastcgi.conf;
                fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
                fastcgi_split_path_info ^/webmail/(.+\.php)(/.*)$;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /usr/share/webapps/roundcubemail/$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param PHP_VALUE open_basedir="/tmp/:/var/cache/roundcubemail:/usr/share/webapps/roundcubemail:/etc/webapps/roundcubemail:/usr/share/pear/:/var/log/roundcubemail";
        }
}

その後 nginx.service再起動してください。

Roundcube のインストール

ブラウザで http://localhost/roundcube/installer を開いて Roundcube のインストールウィザードを行ってください。

セキュリティ上、ウィザードを完了したら config.inc.php から $config['enable_installer'] = true; を削除してインストーラーを無効化してください。

~/roundcube/config ディレクトリにはサーバーに関する重要な情報が含まれるため、以下の設定を追加してディレクトリにアクセスできないようにすることを推奨します:

/etc/httpd/conf/extra/roundcube.conf
  <Directory /usr/share/webapps/roundcubemail/config>
     Options -FollowSymLinks
     AllowOverride None
     Require all denied
  </Directory>

ヒントとテクニック

TLS 認証しかできない IMAP/SMTP サーバーを使用する

最近の IMAP/SMTP サーバーでは暗号化された認証 (STARTTLS) しかできないのが普通です。TLS 認証を使用する場合、ウェブベースのインストーラーは役に立ちません。/etc/webapps/roundcubemail/config/config.inc.php を手動で編集して、以下の行を追加してください:

 $config['default_host'] = 'tls://mail.my_domain.org';
 // For STARTTLS IMAP
 $config['imap_conn_options'] = array(
     'ssl' => array(
       'verify_peer'       => true,
       // certificate is not self-signed if cafile provided
       'allow_self_signed' => false,
       'cafile'  => '/etc/ssl/certs/Your_CA_certificate.pem',
       // probably optional parameters
       'ciphers' => 'TLSv1+HIGH:!aNull:@STRENGTH',
       'peer_name'         => 'mail.my_domain.org',
     ),
 );
 // For STARTTLS SMTP
 $config['smtp_conn_options'] = array(
     'ssl' => array(
       'verify_peer'       => true,
       // certificate is not self-signed if cafile provided
       'allow_self_signed' => false,
       'cafile'  => '/etc/ssl/certs/Your_CA_certificate.pem',
       // probably optional parameters
       'ciphers' => 'TLSv1+HIGH:!aNull:@STRENGTH',
       'peer_name'         => 'mail.my_domain.org',
     ),
 );

mail.my_domain.org は SSL 証明書の CN ホストネーム (IMAP サーバーのホストネーム) に、/etc/ssl/certs/Your_CA_certificate.pem は SSL 証明書のパスに置き換えてください。ciphers は IMAP サーバーによって許可されている暗号にあわせて編集してください。

PHP の SSL 設定オプションについては こちら を参照。

PDF と OpenDocument ファイルのプレビュー

Roundcube の拡張で添付された PDF や OpenDocument ファイルをプレビューすることができます。

roundcubemail-plugins-kolabAUR パッケージをインストールして設定ファイルに以下の行を追加して拡張を有効にしてください:

/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
    'pdfviewer',
    'odfviewer'
);

ファイルのパーミッションに問題が起こる場合、以下のコマンドを試してみてください:

# chown -R http:http /usr/share/webapps/roundcubemail/plugins/odfviewer/files

カレンダーのサポート

roundcubemail-plugins-kolabAUR パッケージをインストールしてください。

Roundcube のデータベースを更新してください:

# mysql -u root -p roundcubemail < /usr/share/webapps/roundcubemail/plugins/calendar/drivers/database/SQL/mysql.initial.sql

カレンダーのデフォルト設定をコピーしてください:

# cp /usr/share/webapps/roundcubemail/plugins/calendar/config.inc.php.dist /usr/share/webapps/roundcubemail/plugins/calendar/config.inc.php

Sabre\VObject\Property\Text Not Found

エラーが表示される場合、プラグインに Sabre が含まれていないか、バージョンが古くなっています。更新してください:

# cd /usr/share/webapps/roundcubemail
# composer update
# composer require sabre/dav ~3.1.3

プラグインの有効化

/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
    'calendar'
);

CardDav でアドレス帳を同期

アドレス帳を使ってアドレスなどを自動補完できると便利です。連絡先をどこかに保存していて、リモートアプリケーションによって CardDav で同期できる場合、roundcube-rcmcarddavAUR[リンク切れ: パッケージが存在しません] 拡張を使うことで Roundcube でリモートのアドレス帳にアクセスできます。有効にするには、以下の行を設定ファイルに追加してください:

/etc/webapps/roundcubemail/config/config.inc.php
$config['plugins'] = array(
    'carddav'
);

詳しくは こちら を参照してください。

トラブルシューティング

SMTP Error: Authentication failure

config.inc.php の以下の設定を無効化 (コメントアウト) してみてください:

//$config['smtp_user'] = '%u';
//$config['smtp_pass'] = '%p';

参照