Install Horde 5 Webmail for ISPConfig on Debian Jessie through PEAR

Horde is a groupware suite that offers email, calendar, task, contact management and more things. It also offers SyncML and ActiveSync to synchronize with your cell phones or other software. You can find out more about Horde on their web page: http://www.horde.org/

This Howto assumes that you followed the ISPConfig 3 installation for Debian Jessie (Apache2, Bind, Dovecot) and all the packages there.

 

1. Install necessary packages

apt-get install php5-sasl php5-intl libssh2-php php5-curl php-http php5-xmlrpc php5-geoip php5-ldap php5-memcache php5-memcached php5-tidy

 

2. Remove conflicting packages

The php5-xcache package is not working with Horde. Instead of php5-xcache one of the other cache tools can be used like memcache.

apt-get remove php5-xcache

 

3. Register the Horde Pear channel

pear channel-discover pear.horde.org

 

4. Set the Horde installation directory

pear install horde/horde_role
pear run-scripts horde/horde_role

You'll be asked the following question:

Filesystem installation for base Horde application: /var/www/horde

You can also chose another folder for the web-accessible horde files. However, you'll need to adjust the path in the following steps then.

 

5. Install Horde Groupware Webmail Edition

pear install -a -B horde/webmail

This takes a while and there will be some errors regarding missing pear packages. Those will be fixed later.

 

6. Create MySQL Database

The Horde installation script will not create a MySQL database on its own. So we have to create it first and also the according user.

Enter the MySQL shell as

mysql -u root -p

Once entered, create the database and user 'horde' with password 'PASSWORD'. If you want to alter the database name, username, change according information. Set your own password of course.

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

Exit the MySQL Shell again

exit;

 

7. Run installation script

webmail-install

You'll be asked the following questions:

What database backend should we use? mysql

Username to connect to the database as: The username you set in the previous step

Password to connect with: The password you set in the previous step

How should we connect to the database? unix

Location of UNIX socket: Just press [enter]

Database name to use: The database name you set in the previous step

Internally used charset: utf-8

Use SSL to connect to the server: 0 *

Certification Authority to use for SSL connection: Just press [enter]

Split reads to a different server? false

Specify an existing mail user who you want to give administrator permissions (optional): [email protected] **

* Only set SSL to 1 if you can provide for each domain an SSL cert.

** Select an existing email user. That user then has configuration rights from within Horde itself. This is needed to create initial configuration files.

 

8. Create custom phptmp folder and chown horde folder to Apache user

mkdir /var/www/horde/phptmp/
chown -R www-data:www-data /var/www/horde

 

9. Add additional PEAR components

pear install channel://pear.php.net/Console_GetoptPlus-1.0.0RC1
pear install horde/Horde_ManageSieve
pear install channel://pear.php.net/XML_Serializer-0.20.2
pear install channel://pear.php.net/Date_Holidays-0.21.8
pear install channel://pear.php.net/Text_LanguageDetect-0.3.0
pear install pear/HTTP_Request2
pear install channel://pear.php.net/Console_Color2-0.1.2
pear install channel://pear.php.net/Numbers_Words-0.18.1
pear install channel://pear.php.net/Image_Text-0.7.0
pear install pear/Console_Getargs

 

10.Add local PEAR holiday calendars (optional)

There are several holiday calendars already in PEAR available. By default, they are not installed. Select one or more of the following calendars if you want to install them. This enables in Horde Kronolith (=calendar) to show holidays for that country. Of course, you could also add your own custom calendar to the PEAR installation.

pear install channel://pear.php.net/Date_Holidays_Australia-0.2.2
pear install channel://pear.php.net/Date_Holidays_Austria-0.1.6
pear install channel://pear.php.net/Date_Holidays_Brazil-0.1.2
pear install channel://pear.php.net/Date_Holidays_Croatia-0.1.1
pear install channel://pear.php.net/Date_Holidays_Czech-0.1.0
pear install channel://pear.php.net/Date_Holidays_Denmark-0.1.3
pear install channel://pear.php.net/Date_Holidays_Discordian-0.1.1
pear install channel://pear.php.net/Date_Holidays_EnglandWales-0.1.5
pear install channel://pear.php.net/Date_Holidays_Finland-0.1.2
pear install channel://pear.php.net/Date_Holidays_Germany-0.1.2
pear install channel://pear.php.net/Date_Holidays_Iceland-0.1.2
pear install channel://pear.php.net/Date_Holidays_Ireland-0.1.3
pear install channel://pear.php.net/Date_Holidays_Italy-0.1.1
pear install channel://pear.php.net/Date_Holidays_Japan-0.1.3
pear install channel://pear.php.net/Date_Holidays_Netherlands-0.1.4
pear install channel://pear.php.net/Date_Holidays_Norway-0.1.2
pear install channel://pear.php.net/Date_Holidays_PHPdotNet-0.1.2
pear install channel://pear.php.net/Date_Holidays_Portugal-0.1.1
pear install channel://pear.php.net/Date_Holidays_Romania-0.1.2
pear install channel://pear.php.net/Date_Holidays_SanMarino-0.1.1
pear install channel://pear.php.net/Date_Holidays_Serbia-0.1.0
pear install channel://pear.php.net/Date_Holidays_Slovenia-0.1.2
pear install channel://pear.php.net/Date_Holidays_Spain-0.1.4
pear install channel://pear.php.net/Date_Holidays_Sweden-0.1.3
pear install channel://pear.php.net/Date_Holidays_Turkey-0.1.1
pear install channel://pear.php.net/Date_Holidays_Ukraine-0.1.2
pear install channel://pear.php.net/Date_Holidays_UNO-0.1.3
pear install channel://pear.php.net/Date_Holidays_USA-0.1.1
pear install channel://pear.php.net/Date_Holidays_Venezuela-0.1.1

 

11. Create /etc/apache2/conf-available/horde.conf with the following content

Alias /Microsoft-Server-ActiveSync /var/www/horde/rpc.php
Alias /horde /var/www/horde
<Directory /var/www/horde>
           Options +FollowSymLinks
           AllowOverride All
           Require all granted
           AddType application/x-httpd-php .php
           php_value include_path ".:/usr/share/php"
           php_value open_basedir "none"
           php_value upload_tmp_dir "/var/www/horde/phptmp/"
</Directory>

Then enable this new apache config snippet:

a2enconf horde

 

12. Restart apache

/etc/init.d/apache2 restart

 

13. Edit /var/www/horde/config/conf.php and set

$conf['testdisable'] = false; 

 

14. Open the horde test page on any domain

http://www.domain.com/horde/test.php

Most of the settings should be ok now. However, you might want to alter some of the default php garbage collection stuff.

Re-edit the /var/www/horde/conf/conf.php and disable the test page

$conf['testdisable'] = true;

 

15. Fix the BaseRewrite option

The default setup won't properly recognize the BaseRewrite option and makes Nag fail to add/edit entries. To fix this you need to edit the /var/www/horde/.htaccess file and search for

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond   %{REQUEST_FILENAME}  !-d
    RewriteCond   %{REQUEST_FILENAME}  !-f
    RewriteRule ^(.*)$ rampage.php [QSA,L]
</IfModule>

and replace the whole block with this

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /horde
    RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond   %{REQUEST_FILENAME}  !-d
    RewriteCond   %{REQUEST_FILENAME}  !-f
    RewriteRule ^(.*)$ rampage.php [QSA,L]
</IfModule>

Notice: When you update Horde this file might get overwritten. In that case, just edit it again.

 

16. Allowing users to change their password from Horde (optional)

Horde can enable to let people change their ISPConig password from within Horde. For this, Horde provides a Passwd addon that needs to be configured to work with ISPConfig

Install the addon and chown it to Apache user:

pear install -a -B horde/passwd
chown -R www-data:www-data /var/www/horde/passwd

Horde also provides a simple way to alter configuration files with local values. This is done by copying an existing config file (e.g. conf.php) to conf.local.php. This can be useful if you want to alter the default preference settings of some Horde applications e.g. use by default a 24h clock. So you can provide a homogenous starting configuration for new users. The same also goes for the Passwd addon. By using a local config file we make sure, a future update of horde won't override our settings.

cp -a /var/www/horde/passwd/config/backends.php /var/www/horde/passwd/config/backends.local.php

The above command is one line.

Now edit the /var/www/horde/passwd/config/backends.local.php file and search for

$backends['sql'] = array (
  'disabled' => false,
  'name' => 'SQL Server',
  [...]
    // 'query_lookup' => 'SELECT user_pass FROM horde_users WHERE user_uid = %u',
    // 'query_modify' => 'UPDATE horde_users SET user_pass = %e WHERE user_uid = %u',
  ),
);

and replace the whole block with this

$backends['sql'] = array (
  'disabled' => false,
  'name' => 'SQL Server',
  'preferred' => '',
  'policy' => array(
    'minLength' => 7,
    'maxLength' => 64,
    'maxSpace' => 0,
    'minNumeric' => 1,
  ),
  'driver' => 'Sql',
  'params' => array(
    'phptype' => 'mysql',
    'hostspec' => 'localhost',
    'username' => 'root',
    'password' => '***',
    'encryption' => 'crypt-md5',
    'database' => 'ISPCONFIG_DATABASE',
    'table' => 'mail_user',
    'user_col' => 'email',
    'pass_col' => 'password',
    'show_encryption' => false
    // The following two settings allow you to specify custom queries for
    // lookup and modify functions if special functions need to be
    // performed. In places where a username or a password needs to be
    // used, refer to this placeholder reference:
    // %d -> gets substituted with the domain
    // %u -> gets substituted with the user
    // %U -> gets substituted with the user without a domain part
    // %p -> gets substituted with the plaintext password
    // %e -> gets substituted with the encrypted password
    //
    // 'query_lookup' => 'SELECT user_pass FROM horde_users WHERE user_uid = %u',
   // 'query_modify' => 'UPDATE horde_users SET user_pass = %e WHERE user_uid = %u',
  ),
);

Of course, replace the password with the root MySQL password and change the database name to your ISPConfig database name. Once this is changed, you can use the Passwd tool to change the password from within Horde.

The policy section lets you set various options for what the password must look like. In this setup, it has to be at least 7 characters and it must contain at least 1 number and no white spaces. Check the beginning of this file to find out what other options there are.

 

17. Final things

Once you have made all the changes, login with the administrative user for horde. The email user you set during the webmail-install script setup. Once logged in, go into the administration section and then horde configuration and create all the necessary configs. To start with, you can use the button that just creates them all or you can chose to review the configuration for each horde application yourself and apply changes that you want.

Horde also offers further applications. Visit http://www.horde.org/apps to see what's there.

Horde also offers an RSS feed so that you'll be notified on newer versions and for updating see here: http://www.horde.org/apps/webmail/docs/UPGRADING

Share this page:

8 Comment(s)