RoundCube Logo

RoundCube is a wonderful, free, open source webmail client to help users access their e-mail from any web browser.
RoundCube also has features that can be implemented such as calendars, address books (globally and locally per user), themes, plugins and much more.

This guide is intended to help share the experience I had with installing RoundCube as well as to hopefully help guide others through the process as well.

This guide’s steps were performed on an Ubuntu 16.04 server running PHP7.0 in particular.

Let’s Begin

First, make sure you’re in your home directory by using the command:

cd ~

Then run sudo wget and download the latest tar.gz file from https://roundcube.net/download/

As of this writing the command is:
NOTE: this command will be outdated in the future, so be sure to get the correct COMPLETE URL from the website itself directly.

sudo wget https://github.com/roundcube/roundcubemail/releases/download/1.3.3/roundcubemail-1.3.3-complete.tar.gz

Once the file is downloaded, extract it by using the command:
NOTE: the filename in this example reflects the filename of the wget example. You may need to use a different file name to extract.

sudo tar xfz roundcubemail-1.3.3-complete.tar.gz
Next we'll create a directory to move the files into:
sudo mkdir /var/www/html/webmail

Then we’ll want to move the files extracted into that directory:
NOTES: USERNAME will be the username you’re logged into at the time.
Also: note that roundcubemail-1.3.3 folder is based on the folder created by the tar command, so it may be different at a future date.

sudo mv /home/USERNAME/roundcubemail-1.3.3/* /var/www/html/webmail

Next, we’ll want to install composer for the project directory we’ve just set up in /var/www/html/webmail.
To do this, cd into the directory:

cd /var/www/html/webmail

Then run the commands from the composer website: https://getcomposer.org/download/
WARNING The commands listed below are EXAMPLE and DO change throughout time, so be sure to use the latest commands from the composer website!
(Run one command at a time)

sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

We’ll need to chmod 777 for php composer-setup.php to run

sudo chmod -R 777 /var/www/html/webmail
php composer-setup.php
php -r "unlink('composer-setup.php');"
Next, be sure to run the following commands:
sudo apt install php-mbstring php-xml php7.0-gd php7.0-zip php7.0-intl php-imagick php7.0-ldap php-net-ldap3
sudo service apache2 restart

Once you’ve completed this step, you’ll want to rename the composer.json-dist to composer.json

sudo mv /var/www/html/webmail/composer.json-dist /var/www/html/webmail/composer.json

WARNING FOR THE NEXT STEP, DO NOT USE SUDO! It will mess up your entire install and you’ll have to restart all over.
Run the command:

php composer.phar install --no-dev

The directories of /var/www/html/webmail/temp and /var/www/html/webmail/logs should exist already.
But if not, follow this step, otherwise skip it.
Optional Step:
We’ll need to create a temp and log folder within the webmail directory for roundcube.
And we’ll need to give it www-data group access (Apache)

sudo mkdir /var/www/html/webmail/temp
sudo mkdir /var/www/html/webmail/logs
sudo chown -R www-data /var/www/html/webmail

Database Configuration

First, connect to the mysql server using your user settings.
If you don’t have a user other than root configured for your MySQL install, do so asap.

(Optional) Create New User:

mysql -u root -p

NOTE: USE your own unique username. And replace password with your own actual password for the user.
For example sake, I’m using roundcubeuser.
Note: During mysql> prompt

CREATE USER 'roundcubeuser'@'localhost' IDENTIFIED BY 'password';
Create the database for roundcube

Note: During mysql> prompt

CREATE DATABASE roundcubemail;
GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcubeuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

We’ll also need to set the timezone:
Note: Your timezone may vary. For more information on timezone commands go here: http://php.net/manual/en/timezones.php
Also Note: this command was taken and modified for php7 slightly from: https://github.com/roundcube/roundcubemail/wiki/Installation

sudo sed -i -e "s/^;date\.timezone =.*$/date\.timezone = 'UTC'/" /etc/php/7.0/apache2/php.ini

You’ll need to reload and restart the apache server at this time to load everything up (the date mainly):

sudo service apache2 reload
sudo service apache2 restart

RoundCube Install

Next, go to http://<Your Server Address>/webmail/installer

Everything should have a green OK — they are REQUIRED even if not used.
The only exception to this is the database checks. Not all database support is required, but at least ONE of them is required.

If you meet the requirements of this page, click the next button on the page.

Next Step Configure RoundCube…

From here, you’ll need to go through the RoundCube wizard and configure your RoundCube webmail.

I’ve decided to hold off and create a guide for the configuration in a future guide since the configuration itself can be a wide sprawling array of different routes for how you may need to configure your particular server.

One thing I will note,  is that if you’re having difficulties with retrieving SMTP or IMAP during the install configuration testing you may want to try modifying the file:

/var/www/html/webmail/config/config.inc.php

And add to it:

$config['smtp_conn_options'] = array(
  'ssl'         =&gt; array(
    'verify_peer'  =&gt; false,
    'verify_peer_name'  =&gt; false,
  ),&lt;span style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" data-mce-type="bookmark" class="mce_SELRES_start"&gt;&lt;/span&gt;
);
$config['imap_conn_options'] = array(
  'ssl'         =&gt; array(
     'verify_peer'  =&gt; false,
     'verify_peer_name'  =&gt; false,
   ),
 );

Best of luck!

And for more information please view the source of this guide at:
https://github.com/roundcube/roundcubemail/wiki/Installation

For more information about configuration go to:
https://github.com/roundcube/roundcubemail/wiki/Configuration

And don’t forget to secure your server with the proper .htaccess files and other security measures.