How to Install Roundcube Webmail on Ubuntu16.04

  • 4 min read
  • Jul 09, 2016

Roundcube is a web application which can be used to access your emails from a web browser. It is a free and open source software tool by Roundcube Webmail project. It has a clean user interface and provides many features like full support for MIME and HTML messages, multilingual capabilities (70+ languages), find-as-you-type address book, threaded message listing, spell checking and many more. Recently, Roundcube version 1.2 has been released and in this article, let us learn how to install and configure the same on Ubuntu 16.04.


Before going ahead with Roundcube installation, we need to first install LAMP (Linux, Apache, MySQL and PHP) packages.

sudo apt-get install lamp-server^

Creating MySQL Database and User

Login to MySQL as root and create a new MySQL database. Here I’m creating one by name roundcubedb and assigning a password.

mysql -u root -p

tester@BNPTHKPD:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.7.12-0ubuntu1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.


mysql> create database ’roundcubedb’;
Query OK, 1 row affected (0.00 sec)

mysql> create user ‘mailadmin’ identified by ‘mailadmin’;
Query OK, 0 rows affected (0.00 sec)

Let us now grant complete access to the ’roundcubedb’ to this new user ‘mailadmin’.

mysql> grant all privileges on roundcubedb.* to ‘mailadmin’;
Query OK, 0 rows affected (0.00 sec)

Flush the privilege table and exit from MySQL command prompt

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Install Roundcube webmail

We will now download and install the latest version (v1.2) of Roundcube from github.

tester@BNPTHKPD:~$ cd /tmp && wget
–2016-06-20 13:30:22–

The above command creates a tmp directory under / and downloads the roundcubemail-1.2.0 tar file into it.

Let us extract the archive into /var/www/webmail directory

tester@BNPTHKPD:/tmp$ sudo tar -xzvf roundcoubemail-1.2.0-complete.tar.gz -C /var/www
tester@BNPTHKPD:/tmp$ sudo mv /var/www/roundcubemail-1.2.0/ /var/www/webmail

Change the ownership of ‘/var/www/webmail’ to ‘www-data’ which is the user and group web server.

sudo chown -R www-data:www-data /var/www/webmail/*

sudo chown -R www-data:www-data /var/www/webmail/

Import the roundcubedb database into MySQL server and login to the server.

mysql -u root -p roundcubedb < /var/www/webmail/SQL/mysql.initial.sql

In order to start the installation, open the web browser (chrome / firefox) and type the following into the address bar:


It pops up the following page:

Roundcube installer screen

This checks if all the required extensions, modules and databases are installed properly. Take a look at it carefully and install the ones against which you find ‘NOT OK’ or ‘NOT AVAILABLE’. In some cases, only one of them will be required and not all. Hence, following the instructions carefully on this page is important.

Click on the ‘Next’ button. It will take you to the configuration page. Here we need to fill in the MySQL database details that we created a while ago. If we want to access other mail accounts from Roundcube like Gmail , we need to also fill in the SMTP and IMAP settings in this page. Settings for gmail SMTP and IMAP are found google page.

MySQL DB setup

SMTP settings

SMTP settings

After the setup is complete, press the ‘Create Config’ button which will result in saving the configuration file to /var/www/webmail/config/

Roundcube config successful

When we press the ‘Continue’ button, we will be led do the Test config screen. Here one can optionally test if we are able to send and receive mails to and from the mail server.

This completes the configuration of Roundcube. Now remove the directory /var/www/webmail/installer for security reasons.

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

Roundcube webmail is now ready to be used. Point the browser to http://localhost/webmail. Login screen appears. Sign in using the account for which you have configured Roundcube and you are ready to go!

If all your settings are correct, but you are still facing trouble in logging into your gmail account from Roundcube, here is what you need to check. Login to gmail from a web browser. Go to ‘settings’ and in the ‘Forwarding and POP/IMAP’ tab under ‘IMAP access’, enable the radio button ‘Enable IMAP’.

If this still doesn’t solve the problem, check if ‘Access for less secure apps’ is turned ON in the google settings.

Turning on SecureApps settings

Here comes the Roundcube inbox screen once you login.

Roundcube inbox

Upgrading from previous versions

If you are on a previous version of roundcube and want to upgrade to the latest version, backup the existing installation and database first. Now, go to /var/www/webmail/bin directory and execute the ‘’ script present there in the following way: <target-folder>

Here, ‘target-folder’ is the path to the Roundcube installation that needs to be updated. For more details and post-update activities, refer to the ‘UPGRADING’ file under /var/www/webmail directory.


In this tutorial, we have learnt how to install and configure Roundcube webmail on Ubuntu 16.04. You can also add some additional plugins to extend its functionality and customize it. Go ahead and give it a try.

Related Post :

Leave a Reply

Your email address will not be published. Required fields are marked *