Roundcube: Instalasi

From OnnoWiki
Jump to navigation Jump to search

This is the last part of the Setting up and configuring a mail server series where will cover how to install and configure Roundcube Webmail.

Roundcube is a web-based IMAP email client with a very intuitive and modern user interface written in PHP. To use Roundcube you only need a Web browser. RoundCube includes all the features which you need in an email client such as richtext/HTML message composing, address book, support for MIME/HTML emails, multiple sender identities, spell checking, three column View, drag & drop message management and more.

PHP dependencies

We’ll start off by installing all required PHP dependencies:

sudo apt install php-auth php-intl php-mail-mime php-mail-mimedecode php-mcrypt php-net-smtp \
php-net-socket php-pear  php-xml php7.0-intl php7.0-mcrypt php7.0-xml php7.0-gd php7.0-gd php-imagick

Copy

Set the date.timezone value to UTC:

sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini

Copy

Restart the PHP FPM service for changes to take effect:

systemctl php7.0-fpm restart

Copy Create MySQL Database

Roundcube supports MySQL, PostgreSQL and SQLite database backends.

In this tutorial we will use MySQL as our database server. Create a new database and user and grant privileges to that user over the newly created database:

mysql -u root -p

Copy

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

Copy Download Roundcube

At the time of the writing, 1.3.6 is the latest stable version of Roundcube. Download and extract the Roundcube archive to the /var/www directory:

VERSION=1.3.6
wget -q https://github.com/roundcube/roundcubemail/releases/download/${VERSION}/roundcubemail-${VERSION}-complete.tar.gz
tar xzf roundcubemail-${VERSION}-complete.tar.gz
sudo mv roundcubemail-${VERSION}/ /var/www/roundcubemail
rm -f roundcubemail-${VERSION}-complete.tar.gz

Copy

Nginx and PHP-FPM are running under the www-data user so we need to change the ownership of the /var/www/postfixadmin to that user:

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

Copy Configure Nginx

In the first part of this series, we created an Nginx server block for the PostfixAdmin instance. Open the configuration file and add the following location directives, the ones highlighted in yellow: /etc/nginx/sites-enabled/mail.linuxize.com.conf

...
location /roundcubemail {
   index index.php;
   try_files $uri $uri/ /roundcubemail/index.php;
}
location ~ ^/roundcubemail/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
   deny all;
}
location ~ ^/roundcubemail/(bin|SQL|config|temp|logs)/ {
   deny all;
}
...

Copy

Reload the Nginx service for changes to take effect:

sudo systemctl reload nginx

Copy

Configure Roundcube

Open your browser and navigate to https://mail.linuxize.com/roundcubemail/installer

You will be presented with the following screen:

In the Checking available databases section only the MySQL extension is required.

If all required PHP extensions are loaded we can proceed to the next step, where we can configure our Roundcube installation:

The most important part here is to enter the correct MySQL database settings.

When you are done with the configuration step, proceed to the next step and import Roundcube’s MySQL database structure by clicking on the Initialize database button.

Once the database structure is created we need to to delete the installer directory to prevent reconfiguration and/or unauthorized access.

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

Copy

Enabling Roundcube’s automatic cache-cleaning is optional but recommended:

sudo crontab -u www-data -l | { cat; echo "18 11 * * * /var/www/roundcubemail/bin/cleandb.sh"; } | sudo crontab -u www-data -

Copy Verify your Roundcube Installation

Open your web browser, navigate to: https://mail.linuxize.com/roundcubemail and log in using your email account’s username and password. Enable Roundcube plugins

Roundcube comes with a number of plugins which are disabled by default. In this guide we will enable password and managesieve plugins. This plugins will allow users to create sieve filters and change their passwords from within the Roundcube interface.

/var/www/roundcubemail/config/config.inc.php
// Enable plugins
$config['plugins'] = array('managesieve','password');
// Configure managesieve plugin
$rcmail_config['managesieve_port'] = 4190;
// Configure password plugin
$config['password_driver'] = 'sql';
$config['password_db_dsn'] = 'mysql://postfixadmin:P4ssvv0rD@localhost/postfixadmin';
$config['password_query'] = 'UPDATE mailbox SET password=%c WHERE username=%u';

Copy

Do not forget to enter PostfixAdmin database credentials in the password_db_dsn line.

Conclusion

This tutorial showed you how to install and configure Roundcube Webmail on your Ubuntu system , as well as how to install and enable Roundcube plugins in order to add additional functionalities such as sieve filters.

This is the last post of this series. If you have any questions feel free to leave a comment.