Quantcast
Channel: Johannes Weber – Weberblog.net
Viewing all articles
Browse latest Browse all 311

Roundcube Installation Guide

$
0
0
Roundcube

Roundcube is an email webclient which is easy and intuitive to use. I am using it for my private mails, connecting via IMAP and SMTP to my hoster. One of the great advantages is the “flag” option which is synchronized via IMAP to my Apple devices.

Following is a step-by-step installation guide for Roundcube plus an update scenario. It is a kind of “memo for myself”, but hopefully, others can use it as well.

I wrote this guide as Roundcube 1.1.1 was the newest version. Later in this guide, I updated the installation to version 1.1.2.

The prerequisites for this are an Linux distribution (I am currently using Ubuntu 14.04 LTS 64-bit), a DNS domain name to the static IP address of the server and a valid SSL certificate. I furthermore assume that there is already an Apache server running and a MySQL database active. If not, start with the following that installs apache2, mysql and php5, and enables three specific apache modules. During this process, the SQL root password must be chosen:

sudo apt-get update
sudo apt-get install apache2 mysql-server php5 php-pear php5-mysql
sudo a2enmod ssl
sudo a2enmod headers
sudo a2enmod rewrite
sudo service apache2 restart

The error message “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” can be corrected by setting the correct server name:

sudo nano /etc/apache2/apache2.conf
#add the following line:
ServerName NAME-OF-THE-SERVER

Roundcube Base

Make a folder inside the /var/www path, download the current (not the 1.1.1 version as I did for this record!) and “complete” roundcube version, unpack it, and change the ownership:

sudo mkdir /var/www/roundcube
cd ~
wget https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.1.1/roundcubemail-1.1.1-complete.tar.gz
tar xvf roundcubemail-1.1.1-complete.tar.gz
sudo mv roundcubemail-1.1.1/* /var/www/roundcube/
sudo chown -R www-data:www-data /var/www/roundcube/*

In my case, the hidden “.htaccess” file was NOT copied, so I did it separately:

sudo cp roundcubemail-1.1.1/.htaccess /var/www/roundcube/
sudo chown www-data:www-data /var/www/roundcube/.htaccess

Database

Log into mysql (prompted for the root password), create a new database and user (change the THISISTHEPASSWORD to a new one of your own) and grant the privileges:

mysql -u root -p
CREATE DATABASE roundcube;
CREATE USER 'roundcubeuser'@'localhost' IDENTIFIED BY 'THISISTHEPASSWORD';
GRANT ALL PRIVILEGES ON roundcube.* TO 'roundcubeuser'@'localhost';
FLUSH PRIVILEGES;
exit

Followed by a copy of the initial.sql database that ships with the roundcube download. Note that the password must be specified DIRECTLY behing the -p option. No space in between!

mysql -u roundcubeuser -pTHISISTHEPASSWORD roundcube < /var/www/roundcube/SQL/mysql.initial.sql

Virtual Host

Create a new virtual host for the Apache HTTP server:

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

and paste in the following lines. Replace the “DOMAIN.TLD” with your domain. This actually creates two virtual hosts, one listening on the unencrypted http port 80 (only redirects to https), and the other one on https port 443.

<VirtualHost *:80>
    ServerName webmail.DOMAIN.TLD
    Redirect permanent / https://webmail.DOMAIN.TLD/
</VirtualHost>

<VirtualHost *:443>
    ServerName webmail.DOMAIN.TLD
    ServerAdmin webmaster@DOMAIN.TLD
    DocumentRoot "/var/www/roundcube"
    <Directory "/var/www/roundcube">
        AllowOverride All
    </Directory>
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/webmail.DOMAIN.TLD.crt
    SSLCertificateKeyFile /etc/ssl/private/webmail.DOMAIN.TLD.key
	Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
    ErrorLog /var/log/apache2/webmail.DOMAIN.TLD-error_log
    CustomLog /var/log/apache2/webmail.DOMAIN.TLD-access_log common
</VirtualHost>

To change the SSL cipher suites of apache to better ones, refer to this tutorial.

Enable the new site and reload the apache service:

sudo a2ensite roundcube
sudo service apache2 reload

Finalize via Web GUI

Now, access the following URL in order to finalize the installation:

https://webmail.DOMAIN.TLD/installer/

One thing was noted as an error: “date.timezone:  NOT OK(not set)”. This can be corrected with the following new line inside the php.ini file:

sudo nano /etc/php5/apache2/php.ini
#add the following line, correspondent to your timezone:
date.timezone = "Europe/Berlin"
#and reload the server:
sudo service apache2 reload

In the “Database setup” part, enter the following four values:

localhost
roundcube
roundcubeuser
THISISTHEPASSWORD

This should fit for now. You can do some tests on the final site, then it’s finished.

Finally, as recommended, delete the “installer” folder:

sudo rm -r /var/www/roundcube/installer/

File Size

One thing to adjust is the maximum file size for file attachements (see here). Open the htaccess file and adjust the following two lines:

sudo nano /var/www/roundcube/.htaccess
php_value   upload_max_filesize   30M
php_value   post_max_size         30M

Done. 😉

Update

This is a demo case in which I updated from Roundcube 1.1.1 to 1.1.2. See the changelog  and official howto-upgrade pages from roundcube.

At first, backup the roundcube folder:

sudo cp -r /var/www/roundcube/ ~/roundcube-backup-DATE-OF-TODAY/

and export the whole SQL database, e.g., via phpMyAdmin (not explained here).

Download the new package, extract it, and run the script. Worked without any errors. Great!

wget https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.1.2/roundcubemail-1.1.2-complete.tar.gz
tar xf roundcubemail-1.1.2-complete.tar.gz
cd roundcubemail-1.1.2/
sudo bin/installto.sh /var/www/roundcube/

 


Viewing all articles
Browse latest Browse all 311

Trending Articles