You need to have the following installed in order to run Roundcube. Apache 2.4x with php 5.6x or higher Guide here and MySQL 5.7.x or higher Guide here
For Php you will also need the folowing ports.
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 just hit ok. And for all the other popups just accecpt the default values and hit ok.
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.
Alias /roundcube "/usr/local/www/roundcube/" <Directory "/usr/local/www/roundcube"> Options Indexes FollowSymLinks AllowOverride All Require all granted Allow from all </Directory>
Or 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/ .
Roundcube stores everything in a Database so we need to create one for Roundcube to use. Now you can use phpmyadmin for that or create one superfast using the command line like this.
mysql -u root -p
Enter the MySQL superuser password when prompted.
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
Next up We need to adjust the Roundcube configuration file.
cd /usr/local/www/roundcube/config cp config.inc.php.sample config.inc.php vi config.inc.php
Now we need to adjust the config file to be able to access the MySQL database we just created. So find the following line.
$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
Change the following on that line.
We need to change a few things for default users of Roundcube.
cd /usr/local/www/roundcube/config vi 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;
Finally 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
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 vi need to add it to Roundcubes plugin configuration file.
cd /usr/local/www/roundcube/config vi config.inc.php
Under // List of active plugins (in plugins/ directory) add the following line.
'antiBruteForce',
Now your plugin list should look like this.
'archive', 'zipdownload', 'antiBruteForce',
Restart apache to make the changes take effect.
apachectl restart
Recipient To Contact allows you to quickly add new contacts to address books. It displays a form to quickly save contacts.
We need to create a jqueryui config file first.
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
As with Antibruteforce we need to add it to Roundcubes plugin configuration file.
cd /usr/local/www/roundcube/config vi 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 of Roundcube for the changes to take effect.
Optional Start You can use managesieve to allow users create their own custom rules.
cd /usr/ports/mail/dovecot-managesieve && make install clean
Next in Dovecot's configuration file enable the managesieve service.
vi /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 find out issuing the following command.
sockstat -l4 |grep "dovecot"
You should get an output 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 vi 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 in this case 2000 so the line should look like this.
$config['managesieve_port'] = 2000;
And finally enable managesieve.
cd /usr/local/www/roundcube/config vi 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 of Roundcube for the changes to take effect.
Optional Stop
Optional Start
If you need to run smtps i.e port 465 instead of port 25 find the following line.
$config['smtp_port'] = 25;
And change it to
$config['smtp_port'] = 465;
Restart apache for good measure.
apachectl restart
Optional Stop