virtualmin gotchas -- installing roundcube

When installing Roundcube in a virtualmin virtual server, sometimes there is a failure, with the message Database connection failed: DBI connect failed : Access denied for user 'adminuser'@'localhost'. The table is actually created but is empty as the script can’t install the tables.

Basically, we need to create a database user that can access databases and the way to do that is:

  • Go to Virtualmin / Edit databases / select the roundcube database / Manage Database / Execute SQL
  • GRANT ALL PRIVILEGES ON accountname_roundcube.* TO adminuser@localhost IDENTIFIED BY 'password';
  • The adminuser is the domain admin, the password is the password for that user.

Then run the Install Scripts/Roundcube install again and it should be successful.

A couple of other things to do:

  1. Virtualmin leaves the installer script in place, so it is best to delete that folder. Even though it is disabled in the config, it won’t be needed. /home/domain/public_html/roundcube/installer.

  2. On my Virtualmin installation there is one final step which, apparently, is unique to my setup. When going to https://mydomain.com/roundcube all I get is a download of the PHP script. Edit the Apache config file for the domain (/etc/apache2/sites-available/mydomin.com.conf) and remove the lines RemoveHandler .php, RemoveHandler .php7 and php_admin_value engine Off. These lines appear twice, once in the http section, once in the SSL section. Restart Apache.

This should be all that is needed. It is also possible to install Roundcube manually, but I find the Install Scripts simpler (when they work).