Write Review


Roundcube is an open-source webmail solution that’s written in PHP. It comes with an easy to install and use interface which runs on a standard web server.  It also features a web-based IMAP client to help you access an email server from anywhere on any web-browser.

This tutorial will take you step-by-step on how to install Roundcube on Ubuntu 18.04 LTS (Bionic Beaver).


Before you start, you need to have the following:

If all the above requirements are in place, you can now start the installation.

Step 1-
Downloading Roundcube

The next thing is to download Roundcube. At the time of writing, the latest version is 1.3.7. Choose the latest stable Roundcube version on their official download page.

Execute the command below to download the most recent version of Roundcube.

$ wget https://github.com/roundcube/roundcubemail/releases/download/1.3.7/roundcubemail-1.3.7-complete.tar.gz

Once you have downloaded the file, extract the archive using this command:

$ tar -xvzf roundcubemail-1.3.7-complete.tar.gz

Now, transfer the extracted file to the root directory on Apache:

$ mv roundcubemail-1.3.7/var/www/html/roundcube

Next, allow the roundcube directory to provide proper write permissions:

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

Step 2 -
Installing And Configuring Roundcube

We can now start installing Roundcube. This involves several steps as we shall find out in this section.

(a) Configuring Database For Roundcube

Now, the first thing when configuring the database for Roundcube is securing your MariaDB installation. Run the command below to secure MariaDB

$ sudo mysql_secure_installation

You will be prompted to answer the following questions:

Enter current password for root (enter for none): Since you just installed MariaDB and no password is set, Press Enter.

Set root password? [Y/n]: Press Y

New password: Enter password

Re-enter new password: Repeat the password

Remove anonymous users? [Y/n]: Y

Disallow root login remotely? [Y/n]: Y

Remove test database and access to it? [Y/n]:  Y

Reload privilege tables now? [Y/n]:  Y

Next, execute the commands below to login to MariaDB shell:

$ sudo mysql -u root -p

Enter your login credentials to access MariaDB shell. Next, run the command below to create a new database called roundcubemaildb:

createdatabase roundcubemaildb;

Next, execute the command below to create a new user on localhost.

createuser roundcubeuser@localhost;

Once that is done, run the command below to set the password for the user:

setpasswordfor roundcubeuser@localhost= password("your-password");

Next, grant privileges of the database to the user you created. Run the command below to achieve this:

grant all privilegeson roundcubemaildb.* to roundcubeuser@localhost identifiedby'your-password';

Flush the privileges to implement the changes


Execute the commands below to exit the MariaDB shell:


Next, import the tables to the newly created Roundcubedb database

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

(b) Configuring Apache For Roundcube

The next step is to configure the Apache virtual host for Roundcube. The first thing is to fashion Roundcube’s Apache2 virtual host file. Run the command below:

$ sudo nano /etc/apache2/sites-available/webmail.conf

Add the lines below, in the virtual host file:

<VirtualHost *:80>
        ServerAdmin admin@example.com
        DocumentRoot /var/www/html/roundcube

        CustomLog${APACHE_LOG_DIR}/roundcube_access.log combined

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

Save and exit the Nano editor. Then, execute the command below to enable the file you have created:

$ sudo a2ensite roundcube

Next, execute the command below to enable the rewrite module for Apache and restart the Apache server:

$ sudo a2enmod rewrite
$ sudo systemctl restart apache2

Now, check Apache status.

$ sudo systemctl status apache2

This will give you an output similar to the one below:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
   Active: active (running) since Tue 2018-04-2420:14:39 UTC; 9min ago
 Main PID: 2583 (apache2)
    Tasks: 55 (limit: 1153)
   CGroup: /system.slice/apache2.service
           ├─2583 /usr/sbin/apache2 -k start
           ├─2585 /usr/sbin/apache2 -k start
           └─2586 /usr/sbin/apache2 -k start

(c) Installing And Configuring Roundcube

To configure Roundcube, start by changing the permission and ownership of the webmail folder to ensure Apache has permission to create the configuration files and edit them.

$ sudo  chown -R www-data:www-data /var/www/html/webmail/
$ sudo  chmod 755 /var/www/html/webmail/temp/ /var/www/html/webmail/logs/

Now, install Roundcube using the installer in the folder. Here, you need to include the IP address, the domain name, and the installer’s name as follows:


In this case, we are going to use this address, but if we won’t change the default site, it is important to include the IP address or domain name, the webmail folder, as well as the installer’s name as follows: http://domain_name_or_IP/webmail/installer

Ensure you have all the PHP extensions needed when checking the environment for Roundcube.

How To Install Latest Roundcube Webmail on Ubuntu 18

How To Install Latest Roundcube Webmail on Ubuntu 18

Click the Next button where you will be prompted to configure key setting to create a default configuration file for webmail.

General configuration: Here, you can enter your product name that will appear on the Roundcube page.

How To Install Latest Roundcube Webmail on Ubuntu 18

Database setup: Enter the information about Roundcube database configured with Mysql.

How To Install Latest Roundcube Webmail on Ubuntu 18

IMAP setting: If you have already installed a mail server, you can enter its details here. If not, create one on Gmail. If you don’t want to keep on indicating the domain name, then enter the domain you have in the username_domain line and create a new user in the database by checking the box auto_create-user.

How To Install Latest Roundcube Webmail on Ubuntu 18

SMTP setting: In this section, enter the information for Gmail smtp and a smtp port for SSL. Don’t forget to check the box near the Use the current IMAP username and password for SMTP authentication and leave the area labelled smtp_user/smtp_pass blank.

How To Install Latest Roundcube Webmail on Ubuntu 18

Plugins: Select an appropriate plugin to use in Roundcube. Make sure you read and understand the description to choose the right one.

How To Install Latest Roundcube Webmail on Ubuntu 18

Now select CREATE CONFIG to save your configuration in a file located in the webmail directory.

How To Install Latest Roundcube Webmail on Ubuntu 18

Now, go ahead and test these settings by providing the details for SMTP and IMAP for the tests.

How To Install Latest Roundcube Webmail on Ubuntu 18

How To Install Latest Roundcube Webmail on Ubuntu 18

You may see a warning message coming from Roundcube prompting you to delete the installer file.

$ sudo rm -rf /var/www/html/webmail/installer/

If you are still getting an error after this, then you need to allow less secure apps in Gmail to avoid further restrictions from Google.

How To Install Latest Roundcube Webmail on Ubuntu 18

Go to the login page and fill in your credentials.

How To Install Latest Roundcube Webmail on Ubuntu 18

You should see the Roundcube webmail homepage.

Now check in your webmail client if the process is successful.

At this point, you can access your mail server and use your credentials to login in Roundcube. You can now install some themes and plugins to improve the look and performance for your site.


Congratulations. You have now successfully installed the latest Roundcube webmail on Ubuntu 18.04 LTS. Enjoy the experience.

Check out these top 3 Linux hosting services

Was this article helpful?