Debian 8 in its repository holds version 1.1.5 of Roundcube. That is fine because that’s a stable version and it’s working without mentionable issues. However I wanted to install the current version (1.2.2) because it has a number of features I like. During installation I followed Roundcube’s own howto.

Basically I will just install the new Roundcube next to the old one and afterwards remove the older Roundcube.

I’m assuming your html files are in /var/www.

# cd /var/www

Download the source:
Head over to https://roundcube.net/download/. I’m downloading the 1.2.2 Complete version because it includes necessary third-party packages. On the server:

# wget https://github.com/roundcube/roundcubemail/releases/download/1.2.2/roundcubemail-1.2.2-complete.tar.gz

Extract the tar file:

# tar xvfz roundcubemail-1.2.2-complete.tar.gz

Rename the directory for typo reduction purposes:

# mv roundcubemail-1.2.2 newcube

Set permissions:

# chown -R www-data:www-data newcube

For security reasons move the temp directory out of the publicly accessible directory and delete the logging directory:

# mv /var/www/newcube/temp /var/roundcubetemp (or whatever directory you fancy).
# rm -rf /var/www/newcube/logs

Because we don’t want to overwrite the old Roundcube version we’ll set up a new database. I’m using the same user as for the old database. Note that you might find the old user’s password in /etc/roundcube/debian-db.php. Of course if you find it easier feel free to create a new user for this database.

# mysql -u root -p
mysql> CREATE DATABASE roundcube122;
mysql> GRANT ALL PRIVILEGES ON `roundcube122`.* TO 'roundcube'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

Import the preconfigured MySQL database into the newly created one:

# mysql -u root -p roundcube122 < /var/www/newcube/SQL/mysql.initial.sql

Continue the installation from your browser: point it to https://example.com/newcube/installer/
Because I had the repository version installed all PHP and third-party requirements were already met. If some of them aren’t install and/or configure them; most are just PHP modules or Debian packages. If everything is in order press the Next button.

This brings us to the configuration page. I suggest to change the following settings:

temp_dir: /var/roundcubetemp/
log_driver: syslog
db_dsnw: MySQL, localhost, roundcube122, roundcube, P4ssw0rd (use the old roundcube user’s password here)

The SMTP server details depend on how you set up your SMTP server (duh). So change to your own settings.
smtp_server: localhost
smtp_user/smtp_pass: Use the current IMAP username and password for SMTP authentication

========
UPDATE
For newer versions (1.2.5) if you’re using ssl (contrary to STARTTLS) use these settings:
default_host: ssl://my.smtp.server (substitute your own server)
default_port: 993 (imap over ssl)
smtp_server: ssl://my.smtp.server
smtp_port: 465
========

When you’re done click CREATE CONFIG.

If no errors occur click CONTINUE.

Delete the installer folder:

# rm -rf /var/www/newcube/installer

Disable the installer in /var/www/newcube/config/default.inc.php:

$config['enable_installer'] = false;

Plugins:
Install curl and git:

# aptitude install curl git

From https://plugins.roundcube.net/

# cd /var/www/newcube
# curl -s https://getcomposer.org/installer | php
# cp composer.json-dist composer.json

To install a plugin first find one you like: https://plugins.roundcube.net/explore/
I’ll be installing this one: https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook

In /var/www/newcube/composer.json find this part:

    "require": {
        "php": ">=5.3.7",
        "pear/pear-core-minimal": "~1.10.1",
        "roundcube/plugin-installer": "~0.1.6",
        "pear-pear.php.net/net_socket": "~1.0.12",
        "pear-pear.php.net/auth_sasl": "~1.0.6",
        "pear-pear.php.net/net_idna2": "~0.1.1",
        "pear-pear.php.net/mail_mime": "~1.10.0",
        "pear-pear.php.net/net_smtp": "~1.7.1",
        "pear-pear.php.net/crypt_gpg": "~1.4.2",
        "roundcube/net_sieve": "~1.5.0"
    },

Add a comma to the second last line and add the plugin and version. The string to add appears at the top of the page. It is also (at the time of writing) the part of the url after ‘https://plugins.roundcube.net/packages/’.

    "require": {
        "php": ">=5.3.7",
        "pear/pear-core-minimal": "~1.10.1",
        "roundcube/plugin-installer": "~0.1.6",
        "pear-pear.php.net/net_socket": "~1.0.12",
        "pear-pear.php.net/auth_sasl": "~1.0.6",
        "pear-pear.php.net/net_idna2": "~0.1.1",
        "pear-pear.php.net/mail_mime": "~1.10.0",
        "pear-pear.php.net/net_smtp": "~1.7.1",
        "pear-pear.php.net/crypt_gpg": "~1.4.2",
        "roundcube/net_sieve": "~1.5.0",         <---- NOTE THE COMMA HERE
        "sblaisot/automatic_addressbook": "~0.4.2" <-- NO COMMA HERE
    },

Do

# php composer.phar install

For more consecutive plugins do

# php composer.phar update