How to Install Latest Roundcube Webmail on Ubuntu 18.04 LTS

Roundcube is a free and open source web-based webmail solution written in PHP. It is a web-based IMAP client, so you can also access your email server from your web browser. You don't need to read and send emails from a desktop mail client. This tutorial shows you how to install RoundCube on Ubuntu 18.04 LTS (Bionic Beaver).

RoundCube Features

  • MIME support, message searching and spell checking.
  • LDAP directory integration for address books.
  • Support multiple languages.
  • Support for shared/global folders and IMAP ACLs.
  • Built-in caching for fast mailbox access.
  • Support for external SMTP server and IDNA.


  • A server running Ubuntu 18.04.
  • A non-root user with sudo privileges.

Install LAMP Server

Before starting, you will need to install Apache, MariaDB, and PHP to your system. First, install Apache and MariaDB with the following command:

sudo apt-get install apache 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

Once all the packages are installed, you will need to change Timezone setting in php.ini file. You can do this with the following command:

sudo nano /etc/php/7.2/apache2/php.ini

Make the following changes:

date.timezone = Asia/Kolkata

Save and close the file, then start Apache and MariaDB service and enable them to start on boot time using the following command:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql

Download Roundcube

First, you will need to download the latest version of Roundcube to your system. You can download it with the following command:


Once the download is completed, extract the downloaded file with the following command:

tar -xvzf roundcubemail-1.3.6-complete.tar.gz

Next, move the extracted directory to the Apache web root directory:

mv roundcubemail-1.3.6 /var/www/html/roundcube

Next, give proper permissions to the roundcube directory:

sudo chown -R www-data:www-data /var/www/html/roundcube
sudo chmod -R 775 /var/www/html/roundcube

Configure the Database

By default, MariaDB installation is not secured. So you will need to secure it first. You can secure it by running the following script:


Answer all the questions as shown below:

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? Y

Once the MariaDB is secured, login to MariaDB shell using the following command:

mysql -u root -p

Enter your root passw**ord, then create a database and user for 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';

Next, flush the privileges and exit from the MariaDB shell using the following command:

MariaDB [(none)]> exit;

Next, you need to import initial tables to roundcubedb database. You can do this using the following command:

cd /var/www/html/roundcube
mysql -u roundcube -p roundcubedb < SQL/mysql.initial.sql

Configure Apache for Roundcube

Next, you will need to create an Apache virtual host file for Roundcube. You can do this with the following command:

sudo nano /etc/apache2/sites-available/roundcube.conf

Add the following lines:

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html/roundcube

        ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log
        CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined

        <Directory /var/www/html/roundcube>
                Options -Indexes
                AllowOverride All
                Order allow,deny
                allow from all

Save and close the file, then enable virtual host file using the following command:

sudo a2ensite roundcube

Next, enable Apache rewrite module and restart Apache server with the following command:

sudo a2enmod rewrite
sudo systemctl restart apache2

Access Webmail

Now, open your web browser and type the URL http://your-ip-address/installer. You will be redirected to the following page:

RoundCube web installer

Web installer - part 2

Once all the requirements are completed, click on the Next button. You should see the following page:

General Configuration:

General configuration

Logging and Database settings:

Database settings

SMTP and IMAP settings:

SMTP Settings

IMAP settings



Here, provide all the details as per your need, then click on the CREATE CONFIG button. You should see the following page:

Create Config

Next, click on the Continue button. You should see the following page:

Config created

Now, click on the Check login button. After completing the installation, remove the directory /var/www/html/roundcube/installer:

sudo rm -rf /var/www/html/roundcube/installer

Now, access your webmail using the URL http://your-ip-address or and sign in using your email.

Roundcube Login

Share this page:

Suggested articles

2 Comment(s)

Add comment


From: Jean-Francois Messier at: 2018-07-27 20:27:49

Just to let you know that in the sudo "apt-get install....." command, there is a typo. You should say "apache2" instead of "apache". Thank You, have a nice day :-)

From: Jean-Francois Messier at: 2018-07-28 16:08:14

You were missing the part where the file must be configured. 

$ cd /var/www/html/toundcube/config

$ cp

$ vi

modify the line starting with "$config['db_dsnw'] = " to update with the appropriate password.