Now before you start. I did not make this guide because I think Roundcube is a better than other webmail clients. It’s here is because someone asked me to set up Roundcube for them ages ago. And I thought I might as well turn it into a guide.
Once you start the installation Roundcube will also install Apache, PHP, and MySQL if these are not installed. This is not really a desirable solution having Roundcube do this, as you may find yourself loosing control over the installation of the applications. I strongly suggest you have these installed prior to running the Roundcube installation.
Right first things first. You need the following installed as well in order for Roundcube to behave correct.
cd /usr/ports/graphics/php56-exif && make install clean BATCH=yes cd /usr/ports/security/php56-openssl && make install clean BATCH=yes cd /usr/ports/security/php56-mcrypt && make install clean BATCH=yes cd /usr/ports/sysutils/php56-fileinfo && make install clean BATCH=yes
cd /usr/ports/mail/roundcube make "WITH=DOCS GD PSPELL MYSQL" install clean
When the option screen pops up [screenshot] just hit “Ok”.
Adjusting apache. By default Roundcube is installed in /usr/local/www/roundcube if you don’t like this you can allways create an alias in apache, for example like this. Remember to restart apache after you are done adjusting the apache configuration.
Alias /roundcube "/usr/local/www/roundcube/"Options Indexes FollowSymLinks AllowOverride All Require all granted Allow from all
Or you can do the more subtle approach would be to create a symlink in your document root location. Either method will work just fine.
cd /usr/local/www/apache24/data ln -s /usr/local/www/roundcube/
Right Roundcube relies on a database in order to function. You can create one yourself or create one really fast doing a few MySQL commands “life is to short for PhpMyadmin”.
Right the fast way goes like this, connect to your MySQL server and enter the credentials when prompted.
mysql -u root -p
Next create the database to be used with Roundcube.
Replace “user” with the username you would like to use with the Roundcube.
Replace “databasename” with the database you would like to use with the Roundcube.
Replace “password” with the password you would like to use with the Roundcube database.
connect mysql create database databasename; GRANT ALL PRIVILEGES ON databasename TO 'user'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON databasename.* TO 'user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES; exit
Now we need to tell Roundcube about the database we just created.
cd /usr/local/www/roundcube/config cp config.inc.php.sample config.inc.php
Now edit the file config.inc.php adjust the following line.
$config['db_dsnw'] = 'mysql://roundcube:[email protected]/roundcubemail';
Change the following on that line.
roundcube should be changed to the username you used for the Roundcube database we created earlier.
pass should be changed to the password you used for the Roundcube database we created earlier.
roundcubemail should be changed to the databasename you used for the Roundcube we created earlier.
Adjust some default values. Edit this file /usr/local/www/roundcube/config/defaults.inc.php
Find the following line.
$config['show_images'] = 0;
And change it to.
$config['show_images'] = 1;
Next find this line.
$config['preview_pane'] = false;
And change it to.
$config['preview_pane'] = true;
Import database schema. We need to import the database scheme. Replace “database” with the databasename you used when creating the Roundcube database and replace “user” with the username you used when creating the Roundcube database.
cd /usr/local/www/roundcube/SQL mysql -u user -p database < mysql.initial.sql
Optional installing Antibruteforce.
cd /usr/local/www/roundcube/plugins fetch http://www.xfiles.dk/content/files/freebsd-qmail/antiBruteForce_v2.0.tar.gz tar zxvf antiBruteForce_v2.0.tar.gz rm zxvf antiBruteForce_v2.0.tar.gz
Next enable Antibruteforce in the plugin configuration file located here /usr/local/www/roundcube/config/config.inc.php
Under // List of active plugins (in plugins/ directory) add the following line
'antiBruteForce',
Your plugin list should now look like this.
'archive', 'zipdownload', 'antiBruteForce',
Restart apache to make the changes take effect.
apachectl restart
Enable Recipient To Contact Plugin to allow you to quickly add new contacts to address books.
cd /usr/local/www/roundcube/plugins/jqueryui cp config.inc.php.dist config.inc.php
Next let's fetch the Recipient To Contact plugin.
cd /usr/local/www/roundcube/plugins/ fetch http://www.xfiles.dk/content/files/freebsd-qmail/recipient_to_contact.tar.gz tar zxvf recipient_to_contact.tar.gz rm recipient_to_contact.tar.gz
Now enable it in the plugin configuration file located here /usr/local/www/roundcube/config/config.inc.php
Under // List of active plugins (in plugins/ directory) add the following lines.
'jqueryui', 'recipient_to_contact',
Now your plugin list should look like this.
'archive', 'zipdownload', 'antiBruteForce', 'jqueryui', 'recipient_to_contact',
Log out and in again of Roundcube for the changes to take effect.
Optional Enable client side filters start:
You can use managesieve to allow users create their own custom rules.
cd /usr/ports/mail/dovecot-managesieve && make install clean BATCH=yes
Next enable the managesieve service in Dovecot's configuration file locate here /usr/local/etc/dovecot.conf
Find this line.
protocols = imap imaps pop3s managesieve
And add managesieve to the end of the line like this.
protocols = imap imaps pop3s managesieve
Restart Dovecut in order to load the new configuration.
svc -t /service/dovecot /service/dovecot/log
Now we need to find out what port managesieve is running on. We can look this up by running the following command.
sockstat -l4 |grep "dovecot"
You should get an output very similar to this.
dovecot imap-login 31043 4 tcp4 *:143 *:* dovecot imap-login 31043 5 tcp4 *:993 *:* dovecot imap-login 31042 4 tcp4 *:143 *:* dovecot imap-login 31042 5 tcp4 *:993 *:* dovecot imap-login 31041 4 tcp4 *:143 *:* dovecot imap-login 31041 5 tcp4 *:993 *:* dovecot pop3-login 31040 4 tcp4 *:995 *:* dovecot pop3-login 31039 4 tcp4 *:995 *:* dovecot pop3-login 31038 4 tcp4 *:995 *:* dovecot managesiev 31037 4 tcp4 *:2000 *:* dovecot managesiev 31036 4 tcp4 *:2000 *:* dovecot managesiev 31035 4 tcp4 *:2000 *:* root dovecot 31015 6 tcp4 *:143 *:* root dovecot 31015 7 tcp4 *:993 *:* root dovecot 31015 8 tcp4 *:995 *:* root dovecot 31015 9 tcp4 *:2000 *:*
And from this output we can see managesieve is running on port 2000. So let's get a configuration file in place.
cd /usr/local/www/roundcube/plugins/managesieve/ cp config.inc.php.dist config.inc.php
Next edit the file we just copied i.e this one /usr/local/www/roundcube/plugins/managesieve/config.inc.php
Find this line it allmost at the top of the file.
$config['managesieve_port'] = null;
And match the port with the output we just got previous. In this case 2000. So the line should look like this.
$config['managesieve_port'] = 2000;
And finally enable managesieve. This is done in the file /usr/local/www/roundcube/config/config.inc.php
Under // List of active plugins (in plugins/ directory) add the following line.
'managesieve'
Now your plugin list should look like this.
'archive', 'zipdownload', 'antiBruteForce', 'jqueryui', 'recipient_to_contact', 'managesieve'
Log out an in again of Roundcube for the changes to take effect.
Optional Enable client side filters stop:
And we are done here.