this is obsolete doc -- see http://doc.nethence.com/ instead

Installing Roundcube 1.1 on FreeBSD 9 

 

http://pbraun.nethence.com/unix/www/apache2.html 

http://pbraun.nethence.com/unix/databases/mysql.html 

 

Note 

Versions used: Apache 2.4, MySQL 5.6, PHP 5.6 and Roundcube 1.1.3. 

 

Requirements 

Make sure those are installed, 

pkg install mysql56-client mysql56-server
pkg install php56 php56-mysqli
#pkg delete php56-mysql
pkg install php56-pdo php56-pdo_mysql
pkg install apache24 mod_php56
pkg install php56-dom \
php56-json \
php56-xml \
php56-session \
php56-sockets \
libiconv zip libzip \
php56-zip
pkg install php56-fileinfo php56-mcrypt php56-mbstring 
#pkg install php56-gd
pkg info | grep php5
pkg install pear-Mail_Mime pear-Mail_mimeDecode pear-Net_SMTP pear-Net_IDNA pear-Auth_SASL
pkg install php56-iconv php56-openssl pecl-intl php56-exif php56-ldap

tune, 

cd /usr/local/libexec/
ls -l | grep apache
rmdir apache
rmdir apache2 # only apache24 remaining

check that php module is present (libphp5.so), 

cd /usr/local/libexec/apache24/
ls -l | grep php

Note. PCRE is now built-in, no need for a phpX-pcre package. 

Ref. REQUIREMENTS in the INSTALL file. 

 

Setting up MySQL 5.6 

Make sure mysql is [up and running](http://pbraun.nethence.com/unix/databases/mysql.html). 

 

Create a database and a user with write access, 

mysql -u root -p
show databases;
create database roundcubemail charset utf8;
select host, user, password from mysql.user;
grant all privileges on roundcubemail.* to roundcube@localhost identified by 'PASSWORD';
quit

Ref. DATABASE SETUP chapter in the INSTALL file 

 

Setup the initial tables in the database, 

mysql -u roundcube -p roundcubemail < /usr/local/www/apache24/data/SQL/mysql.initial.sql

  Enter password: PASSWORD 

 

Setting up Apache 2.4 

Create a [self-signed certificate](http://pbraun.nethence.com/security/openssl.html) if you don't have a real one and setup apache with [SSL and virtualhosts enabled](http://pbraun.nethence.com/unix/www/apache2.html), also enable AllowOverride All on the folder. 

 

Deploying Roundcube 

Deploy the webmail, 

cd ~/
wget https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.1.3/roundcubemail-1.1.3-complete.tar.gz
tar xzpf roundcubemail-1.1.3-complete.tar.gz
rm -rf /usr/local/www/apache24/data/
mv roundcubemail-1.1.3/ /usr/local/www/apache24/data/

 

Secure the thing a little bit, 

cd /usr/local/www/apache24/data/
ls -l favicon.ico
touch favicon.ico
chown -Rh nobody:nogroup .
ll data/vendor/bin/pear
chown -Rh apache:apache configs/
chown -Rh apache:apache logs/
chown -Rh apache:apache temp/
chmod o-rx configs/
chmod o-rx logs/
chmod o-rx temp/

Note. change User and Group accordingly to apache conf. 

 

Ready to go 

Enable and start the deamons, 

cd /etc/

 

cp /usr/local/etc/rc.d/mysql-server rc.d/
echo mysql_enable=YES >> rc.conf
rc.d/mysql-server start

 

cp /usr/local/etc/rc.d/apache24 rc.d/
echo apache24_enable=YES >> rc.conf
rc.d/apache24 start

 

Preparing Roundcube 

Simply use the built-in installer to write the configuration, 

https://mail.example.net/installer/

or create the configuration based on the provided sample, 

cd /usr/local/www/apache24/data/configs/
cp config.inc.php.sample config.inc.php

change/add, 

$config['db_dsnw'] = 'mysqli://roundcube:PASSWORD@localhost/roundcubemail';
$config['debug_level'] = 5;
$config['log_driver'] = 'syslog';
$config['default_host'] = 'localhost';
$config['support_url'] = 'http://pbraun.nethence.com/';
$config['skin_logo'] = 'http://pbraun.nethence.com/fun/cat.jpg';
// $config['des_key'] = 'xxxxxxxxxxxxxxxxxx';
$config['product_name'] = 'Nethence Webmail';
// $config['plugins'] = array();
$config['spellcheck_engine'] = 'atd';
$config['preview_pane'] = true;

 

$config['language'] = en_US;

Note. [using mysqli](http://stackoverflow.com/questions/548986/mysql-vs-mysqli-in-php). 

Ref. http://trac.roundcube.net/wiki/Howto_Config 

 

Eventually change the logo approx 180x50, 

bsd# identify skins/larry/images/roundcube_logo.png
skins/larry/images/roundcube_logo.png PNG 177x49 177x49+0+0 8-bit sRGB 3.79KB 0.000u 0:00.023
bsd# identify skins/classic/images/roundcube_logo.png
skins/classic/images/roundcube_logo.png PNG 178x47 178x47+0+0 8-bit sRGB 3.79KB 0.000u 0:00.000
convert -resize 180x50 ... ...

 

That's it. TODO: Eventually fix the @localhost extension for all users identities. 

 

Troubleshooting 

If you get this error message in the Roundcube error logs, 

db error configuration error. unsupported database driver roundcube

Make sure you've created the two configurations files based (samples are provided). 

 

If you get this error message in the Roundcube error logs, 

"Call to undefined function filter_var()"

Make sure you've installed the 'php5-filter' package. 

 

If you get this error message in the Roundcube error logs, 

Table 'roundcubemail.session' doesn't exist

Truncate all tables and run the initial script.