ウェブメール · 3 min read · Sep 25, 2025
Ubuntu 18.04 LTSに最新のRoundCube Webmailをインストールする方法

Roundcubeは、PHPで書かれた無料でオープンソースのウェブベースのウェブメールソリューションです。これはウェブベースのIMAPクライアントであるため、ウェブブラウザからメールサーバーにアクセスすることもできます。デスクトップメールクライアントからメールを読み書きする必要はありません。このチュートリアルでは、Ubuntu 18.04 LTS(Bionic Beaver)でApacheウェブサーバーとLet’s Encrypt SSL証明書で保護されたRoundCubeをインストールする方法を示します。
RoundCubeの特徴
- MIMEサポート、メッセージ検索、スペルチェック。
- アドレス帳用のLDAPディレクトリ統合。
- 複数言語のサポート。
- 共有/グローバルフォルダーおよびIMAP ACLのサポート。
- 高速なメールボックスアクセスのための組み込みキャッシュ。
- 外部SMTPサーバーおよびIDNAのサポート。
要件
- Ubuntu 18.04 LTSを実行しているサーバー。
- sudo権限を持つ非rootユーザー。
LAMPサーバーのインストール
始める前に、パッケージリストを更新し、保留中の更新をインストールする必要があります:
sudo apt-get update
sudo apt-get upgrade次に、次のコマンドでApacheとMariaDBをインストールします:
sudo apt-get install apache2 mariadb-server php7.2 php7.2-gd php-mysql php7.2-curl php7.2-zip php7.2-ldap php7.2-mbstring php-imagick php7.2-intl php7.2-xml unzip wget curl -yすべてのパッケージがインストールされたら、php.iniファイルのタイムゾーン設定を変更する必要があります。次のコマンドでこれを行うことができます:
sudo nano /etc/php/7.2/apache2/php.ini次の変更を行います:
date.timezone = Europe/Berlinファイルを保存して閉じたら、次のコマンドを使用してApacheとMariaDBサービスを開始し、ブート時に自動的に開始するように有効にします:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mariadb
sudo systemctl enable mariadbRoundcubeのダウンロード
まず、システムに最新のRoundcubeのバージョンをダウンロードする必要があります。次のコマンドでダウンロードできます:
cd /tmp
wget https://github.com/roundcube/roundcubemail/releases/download/1.3.8/roundcubemail-1.3.8-complete.tar.gzダウンロードが完了したら、次のコマンドでダウンロードしたファイルを抽出します:
tar -xvzf roundcubemail-1.3.8-complete.tar.gz次に、抽出したディレクトリをApacheのウェブルートディレクトリに移動します:
mv roundcubemail-1.3.8 /var/www/html/roundcube次に、roundcubeディレクトリに適切な権限を与えます:
sudo chown -R www-data:www-data /var/www/html/roundcube
sudo chmod -R 775 /var/www/html/roundcubeデータベースの設定
デフォルトでは、MariaDBのインストールはセキュリティが確保されていません。したがって、最初にそれを保護する必要があります。次のスクリプトを実行することで保護できます:
mysql_secure_installation以下のようにすべての質問に答えます:
Change the password for root ? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? YMariaDBが保護されたら、次のコマンドを使用してMariaDBシェルにログインします:
mysql -u root -pルートパスワードを入力し、次にRoundcube用のデータベースとユーザーを作成します:
MariaDB [(none)]> CREATE DATABASE roundcubedb;
MariaDB [(none)]> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON roundcubedb.* to 'roundcube'@'localhost';「password」という単語を自分の選択した安全なパスワードに置き換え、このパスワードを覚えておいてください。後でRoundcubeのインストールに必要です。次に、権限をフラッシュし、次のコマンドを使用してMariaDBシェルから退出します:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;次に、初期テーブルをroundcubedbデータベースにインポートする必要があります。次のコマンドを使用してこれを行うことができます:
cd /var/www/html/roundcube
mysql -u roundcube -p roundcubedb < SQL/mysql.initial.sql要求されたときにroundcubeデータベースユーザーのパスワードを入力します。
Roundcube用のApacheの設定
次に、Roundcube用のApache仮想ホストファイルを作成する必要があります。次のコマンドでこれを行うことができます:
sudo nano /etc/apache2/sites-available/roundcube.conf次の行を追加します:
ServerName example.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/roundcube
ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log
CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined
Options -Indexes
AllowOverride All
Order allow,deny
allow from all
example.comを自分のドメイン名に置き換えます。ファイルを保存して閉じたら、次のコマンドを使用して仮想ホストファイルを有効にします:
sudo a2ensite roundcube次に、Apacheのリライトモジュールを有効にし、次のコマンドでApacheサーバーを再起動します:
sudo a2enmod rewrite
sudo systemctl restart apache2Let’s Encryptを使用してRoundCubeのSSLを有効にする
このステップでは、無料のLet’s Encrypt SSL証明書を使用してRoundCubeのSSLを有効にします。最初のステップは、SSL証明書を取得するために使用するcertbot Let’s Encryptクライアントをインストールすることです。
sudo apt-get install certbot python-certbot-apache次のコマンドでSSL証明書をリクエストします:
sudo certbot --apache重要:RoundCubeウェブサイトに使用するドメイン名またはサブドメインは、SSL証明書を取得するためにインターネットからアクセス可能でなければなりません。Certbotは今いくつかの質問をします。赤で示された回答を参照してください。
root@server: certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: a-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: nWhich names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: roundcube.example.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for roundcube.example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/roundcube-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/roundcube-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/roundcube-le-ssl.confPlease choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/apache2/sites-enabled/roundcube.conf to ssl vhost in /etc/apache2/sites-available/roundcube-le-ssl.conf-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://roundcube.example.comYou should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=roundcube.example.com
-------------------------------------------------------------------------------IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/roundcube.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/roundcube.example.com/privkey.pem
Your cert will expire on 2019-06-25. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-leRoundCubeのvhostは、今やhttpsでアクセス可能です。
ウェブメールにアクセス
今、ウェブブラウザを開き、URL https://example.com/installer(URL内のexample.comを自分のドメイン名に置き換えます!)を入力します。次のページにリダイレクトされます:

すべての要件が完了したら、次へボタンをクリックします。次のページが表示されるはずです:
一般設定:

ログとデータベース設定:

ここに、データベース設定ステップで作成したroundcubedbのデータベース詳細を入力します。
SMTPおよびIMAP設定:

プラグイン:

ここで、必要に応じてすべての詳細を提供し、CONFIGを作成ボタンをクリックします。次のページが表示されるはずです:
次に、続行ボタンをクリックします。次のページが表示されるはずです:

今、ログインを確認ボタンをクリックします。インストールが完了したら、/var/www/html/roundcube/installerディレクトリを削除します:
sudo rm -rf /var/www/html/roundcube/installer今、URL http://your-ip-addressまたはhttp://your-domain.comを使用してウェブメールにアクセスし、メールアカウントを使用してサインインします。

RoundCubeは、Ubuntu 18.04 LTSに正常にインストールされました。
新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。