Install Horde 5 Webmail For ISPConfig On Debian Wheezy Through PEAR

Author: Stephan Jau
Revision: v1.0
Last Change: December 27, 2013

Introduction

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 webpage: http://www.horde.org/

This Howto assumes that you followed the ISPConfig 3 installation for Debian Wheezy 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. Register the Horde Pear channel

pear channel-discover pear.horde.org 

 

3. 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.

 

4. 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 fullfilled later.

 

5. 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 database and the user 'horde' with passwod '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 [email protected] IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;

Exit the MySQL Shell again

exit; 

 

6. Run installation script

webmail-install 

You'll be asked the following questions:

What database backend should we use? mysql

Request persistent connections? no

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: no *

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

Split reads to a different server? false

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

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 a 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.

 

7. 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

 

8. Add additional PEAR components

pear install channel://pear.php.net/SOAP-0.13.0
pear install pear/MDB2#mysql
pear install channel://pear.php.net/HTTP_WebDAV_Server-1.0.0RC7
pear install channel://pear.php.net/XML_Serializer-0.20.2
pear install channel://pear.php.net/Date_Holidays-0.21.6
pear install Net_LDAP
pear install channel://pear.php.net/Text_CAPTCHA-0.4.3
pear install pear/HTTP_Request2
pear install channel://pear.php.net/Console_Color2-0.1.1

 

9.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_Austria-0.1.4
pear install channel://pear.php.net/Date_Holidays_Brazil-0.1.2
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.4
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.2
pear install channel://pear.php.net/Date_Holidays_Netherlands-0.1.2
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_Romania-0.1.2
pear install channel://pear.php.net/Date_Holidays_Slovenia-0.1.2
pear install channel://pear.php.net/Date_Holidays_Sweden-0.1.3
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

 

10. Create /etc/apache2/conf.d/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
           order allow,deny
           allow from all
           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>

 

11. Restart apache

/etc/init.d/apache2 restart 

 

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

$conf['testdisable'] = false; 

 

13. 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; 

 

14. 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.

 

15. 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 usefull 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.

 

16. 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 adminsitration 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 a 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:

Suggested articles

18 Comment(s)

Add comment

Comments

By: John Mbir

Hi...

I followed  your guidelines. When i try to login horde. I get this message : Error connecting to mail server.

What could be the problem?

Thank you.

 

By: sjau

 Well, did you setup first according to Falko's howto?

By: felan

Nice howto, but I got a problem. I can't do a channel discover on my debian 7 server. It keeps timing out and that on both my primary and test machines (different networks). I can easily see the URL http://pear.horde.org/channel.xml on my local workstation (on the same network as our test server) Any ideas?

By: sjau

 I don't know why that is the case... I just setup another machine last week... works fine... btw, I used my auto isntaller script: https://github.com/sjau/perfectDebian

By: Ed

Hello,

 

Thank you, but I can't seem to get the horde user register page to write into the dbispconfig db, so I have to manually add a mailbox in the ispCOnfig3 interface (and this means having to use a new password).  Is your tutorial suppossed to write the approved new horde user's email / login and password into the ispconfig database or not? I am not clear on this.  Thanks for making this clear.  Also, are any modifications to the imp config file or the horde conf file necessary to get this working properly?   Thank you very much.

 

I am using horde 5 groupware webmail community edition updated on an updated wheezy, apache2 mysql 5.6 php 5.5 server.

By: sjau

 Well, by altering that passwd/backends file you actually set it up to connect to the ispconfig db and you alter existing users the way ispconfig does. That file just provides means to alter existing users in existing dbs and stuff that can then be used for login.

Just those cahnges are necessary. If you wanna test it, setup a VM somewhere and use my auto installer script: https://github.com/sjau/perfectDebian

By: Giuseppe

Hi

I installed everything as described, error is "Accesso fallito: username o password non corretti." why?

By: sjau

Where does this appear?

By: Martin C

Hi,I have followed and everything appears to be working. Appart from the Address book. When i click on it i get a page which says No data received. ERR_EMPTY_Response. Any ideas?

Cheers,Martin

By: Sebastian W.

I have the same problem!

Do you resolved it?

 

Br

Sebastian

By: Sebastian W.

I found a soulution.

apt-get --purge remove php5-xcache

resolve the problem

By: Tom

I just installed it and cant login.  I am trying to login in with user horde and the passowrd I used.  I also tried root and admin which is also a user on my system.

By: Aivaras

Hi!

I have installed horde (by following this setup) on UBUNTU, and at step 10 (10. Create /etc/apache2/conf.d/horde.conf with the following content)

have problem now.. "No such file or directory"..

I have manualy created directory conf.d, but it not helps..

Can someone help me pleadse, how to adapt this setup/install Horde to Ubunu 14.04?

By: sjau

I assume you use apache 2.4 on your ubuntu installation? Check here:  https://www.howtoforge.com/community/threads/hosting-multiple-mail-domains-only.72876/#post-342931

By: onastvar

my php shows PEAR is here i'm stuck on step #2

 

include_path .:/usr/share/php:/usr/share/pear 2. Register the Horde Pear channel

[email protected]:~# pear channel-discover pear.horde.org

/usr/local/bin/pear: line 28: /usr/local/bin/php: No such file or directory

 

how to fix this?

 

By: onastvar

STEP 13 should be Re-edit the /var/www/horde/config/conf.php and disable the test page

not 

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

By: Frank_zonarix

On multiserver setups also take a look at .../horde/imp/config/backends.php, check for IMAP or POP3 settings in case you cannot connect to the mail server.

By: David

I have everything working except Horde. All other virtual servers work: mailman, ispconfig 3, html, and I can log into horde, but once I'm in, it breaks.  Is it because I installed all the extras (kronolith, etc.) already?  Should I have waited until the first login as admin?

Where, by the way, does horde 5 put its logs by default?  Here is the screen output upon logging in as the first user, designated as admin:

A fatal error has occurred Missing required connection parameter(s). 1. Horde_Core_Block_Layout_View->toHtml() /var/www/horde/services/portal/index.php:35 2. Horde_Core_Block->getContent() /usr/share/php/Horde/Core/Block/Layout/View.php:98 3. Horde_Core_Block->_call() /usr/share/php/Horde/Core/Block.php:175 4. Mnemo_Block_Summary->_content() /usr/share/php/Horde/Core/Block.php:278 5. Mnemo::listMemos() /var/www/horde/mnemo/lib/Block/Summary.php:59 6. Mnemo_Factory_Driver->create() /var/www/horde/mnemo/lib/Mnemo.php:80 7. Mnemo_Driver_Sql->__construct() /var/www/horde/mnemo/lib/Factory/Driver.php:73 Details The full error message is logged in Horde's log file, and is shown below only to administrators. Non-administrative users will not see error details. InvalidArgumentException Object ( [message:protected] => Missing required connection parameter(s). [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/horde/mnemo/lib/Driver/Sql.php [line:protected] => 56 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/horde/mnemo/lib/Factory/Driver.php [line] => 73 [function] => __construct [class] => Mnemo_Driver_Sql [type] => -> [args] => Array ( [0] => OdS8x0fWNOUhDuZ85lL4qvx [1] => Array ( [username] => hordemail [password] => 0m4imsG8/RHsAi21 [protocol] => unix [database] => hordemail [charset] => utf-8 [ssl] => [splitread] => [phptype] => mysql [driverconfig] => horde [umask] => 63 [db] => Horde_Db_Adapter_Pdo_Mysql Object ( [_schemaClass:protected] => Horde_Db_Adapter_Mysql_Schema [_config:protected] => Array ( [charset] => utf-8 [database] => hordemail [password] => 0m4imsG8/RHsAi21 [phptype] => mysql [protocol] => unix [splitread] => [ssl] => [username] => hordemail [adapter] => mysql ) [_connection:protected] => PDO Object ( ) [_transactionStarted:protected] => 0 [_lastQuery:protected] => SELECT DISTINCT s.share_id, s.share_name, s.share_owner, s.share_flags, s.perm_creator_2, s.perm_creator_4, s.perm_creator_8, s.perm_creator_16, s.perm_default_2, s.perm_default_4, s.perm_default_8, s.perm_default_16, s.perm_guest_2, s.perm_guest_4, s.perm_guest_8, s.perm_guest_16, s.attribute_name, s.attribute_desc, s.share_parents FROM mnemo_sharesng s WHERE (share_owner = '[email protected]' OR perm_creator_2 = 1 OR perm_default_2 = 1) AND share_owner = '[email protected]' ORDER BY attribute_name ASC [_rowCount:protected] => 1 [_runtime:protected] => 0 [_active:protected] => 1 [_cache:protected] => Horde_Cache Object ( [_params:protected] => Array ( [compress] => 1 [lifetime] => 86400 ) [_logger:protected] => Horde_Core_Log_Wrapper Object ( ) [_storage:protected] => Horde_Cache_Storage_File Object ( [_file:protected] => Array ( [perm_sql_exists_2gollem:backends:sqlhome] => /tmp/cache_8613860fd31fa8eb89d2d0235b0dd2c5 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/horde_prefs] => /tmp/cache_9c93682ae196579aa94715c48377bf24 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/turba_sharesng] => /tmp/cache_48d12e382c5ce6ee0819414a846c7aa7 [perm_sql_exists_2imp:backends:imap:allow_folders] => /tmp/cache_19daa8778d682e7d1e203f406a2f451d [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/nag_sharesng] => /tmp/cache_3bd71b5be7340f968f23cd61ef1a2915 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/kronolith_sharesng] => /tmp/cache_5a4acbc83293409941b2820e485667e8 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/kronolith_events] => /tmp/cache_0ec27d5431e7602b77799d3bd6584c26 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/ingo_rules] => /tmp/cache_a5de6bb73503f3f7569f5991e19c3591 [Horde_Db_Adapter_Pdo_Mysql4b35836btables/columns/mnemo_sharesng] => /tmp/cache_3a93c95b6a9a62bbb26312c46c36c5f3 ) [_logger:protected] => Horde_Core_Log_Wrapper Object ( ) [_params:protected] => Array ( [prefix] => cache_ [sub] => 0 [umask] => 63 [dir] => /tmp ) ) ) [_cachePrefix:protected] => Horde_Db_Adapter_Pdo_Mysql4b35836b [_logger:protected] => Horde_Core_Log_Logger Object ( [_levels:Horde_Log_Logger:private] => Array ( [EMERG] => 0 [EMERGENCY] => 0 [ALERT] => 1 [CRIT] => 2 [CRITICAL] => 2 [ERR] => 3 [ERROR] => 3 [WARN] => 4 [WARNING] => 4 [NOTICE] => 5 [INFO] => 6 [INFORMATION] => 6 [INFORMATIONAL] => 6 [DEBUG] => 7 ) [_handlers:Horde_Log_Logger:private] => Array ( [0] => Horde_Log_Handler_Syslog Object ( [_options:protected] => Array ( [defaultPriority] => 3 [facility] => 8 [ident] => HORDE [openlogOptions] => ) [_lastIdent:protected] => HORDE [_lastFacility:protected] => 8 [_priorities:protected] => Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 ) [_filters:protected] => Array ( [0] => Horde_Log_Filter_Level Object ( [_level:protected] => 6 ) ) ) ) [_filters:Horde_Log_Logger:private] => Array ( ) ) [_schema:protected] => Horde_Db_Adapter_Mysql_Schema Object ( [_adapter:protected] => Horde_Db_Adapter_Pdo_Mysql Object *RECURSION* [_adapterMethods:protected] => Array ( [adapterName] => 0 [supportsMigrations] => 1 [connect] => 2 [isActive] => 3 [select] => 4 [selectAll] => 5 [selectOne] => 6 [selectValue] => 7 [selectValues] => 8 [selectAssoc] => 9 [execute] => 10 [insert] => 11 [beginDbTransaction] => 12 [commitDbTransaction] => 13 [rollbackDbTransaction] => 14 [quoteString] => 15 [__construct] => 16 [__destruct] => 17 [__sleep] => 18 [__wakeup] => 19 [getOption] => 20 [setCache] => 21 [getCache] => 22 [setLogger] => 23 [getLogger] => 24 [__call] => 25 [supportsCountDistinct] => 26 [supportsInterval] => 27 [prefetchPrimaryKey] => 28 [getLastQuery] => 29 [resetRuntime] => 30 [cacheWrite] => 31 [cacheRead] => 32 [reconnect] => 33 [disconnect] => 34 [rawConnection] => 35 [insertBlob] => 36 [update] => 37 [updateBlob] => 38 [delete] => 39 [transactionStarted] => 40 [addLimitOffset] => 41 [sanitizeLimit] => 42 [addLock] => 43 [insertFixture] => 44 [emptyInsertStatement] => 45 ) ) [_schemaMethods:protected] => Array ( [makeColumn] => 0 [quoteColumnName] => 1 [quoteTableName] => 2 [nativeDatabaseTypes] => 3 [tables] => 4 [primaryKey] => 5 [indexes] => 6 [columns] => 7 [endTable] => 8 [renameTable] => 9 [changeColumn] => 10 [changeColumnDefault] => 11 [renameColumn] => 12 [removePrimaryKey] => 13 [indexName] => 14 [createDatabase] => 15 [dropDatabase] => 16 [currentDatabase] => 17 [typeToSql] => 18 [addColumnOptions] => 19 [buildClause] => 20 [getCharset] => 21 [setCharset] => 22 [_mysqlCharsetName] => 23 [getCollation] => 24 [showVariable] => 25 [caseSensitiveEqualityOperator] => 26 [limitedUpdateConditions] => 27 [__construct] => 28 [setAdapter] => 29 [makeColumnDefinition] => 30 [makeIndex] => 31 [makeTable] => 32 [makeTableDefinition] => 33 [__call] => 34 [__get] => 35 [quote] => 36 [quoteString] => 37 [quoteTrue] => 38 [quoteFalse] => 39 [quoteDate] => 40 [quoteBinary] => 41 [tableAliasLength] => 42 [tableAliasFor] => 43 [table] => 44 [column] => 45 [createTable] => 46 [dropTable] => 47 [addColumn] => 48 [removeColumn] => 49 [addPrimaryKey] => 50 [addIndex] => 51 [removeIndex] => 52 [recreateDatabase] => 53 [distinct] => 54 [addOrderByForAssocLimiting] => 55 [interval] => 56 [modifyDate] => 57 ) ) ) ) ) [1] => Array ( [file] => /var/www/horde/mnemo/lib/Mnemo.php [line] => 80 [function] => create [class] => Mnemo_Factory_Driver [type] => -> [args] => Array ( [0] => OdS8x0fWNOUhDuZ85lL4qvx ) ) [2] => Array ( [file] => /var/www/horde/mnemo/lib/Block/Summary.php [line] => 59 [function] => listMemos [class] => Mnemo [type] => :: [args] => Array ( [0] => 0 [1] => 0 ) ) [3] => Array ( [file] => /usr/share/php/Horde/Core/Block.php [line] => 278 [function] => _content [class] => Mnemo_Block_Summary [type] => -> [args] => Array ( ) ) [4] => Array ( [file] => /usr/share/php/Horde/Core/Block.php [line] => 175 [function] => _call [class] => Horde_Core_Block [type] => -> [args] => Array ( [0] => _content [1] => ) ) [5] => Array ( [file] => /usr/share/php/Horde/Core/Block/Layout/View.php [line] => 98 [function] => getContent [class] => Horde_Core_Block [type] => -> [args] => Array ( ) ) [6] => Array ( [file] => /var/www/horde/services/portal/index.php [line] => 35 [function] => toHtml [class] => Horde_Core_Block_Layout_View [type] => -> [args] => Array ( ) ) ) [previous:Exception:private] => [logged] => 1 )