Install Horde Groupware with ActiveSync (contacts, calendar, etc)

This section contains user-submitted tutorials.
Post Reply
palinka
Senior user
Senior user
Posts: 2172
Joined: 2017-09-12 17:57

Install Horde Groupware with ActiveSync (contacts, calendar, etc)

Post by palinka » 2020-11-13 18:16

My server crashed and burned last week, which led to a complete reinstall of everything. I took this opportunity to upgrade to php7 before re-installing horde.

Horde is a php based groupware app that gives you something magical - ACTIVESYNC and caldav/cardav with groupware features: contacts, calendar, notes, tasks, etc. This is a powerhouse feature that brings your simple hmailserver into the modern world.

Installation is not intuitive. I'm not going to do a step by step tutorial. I'm just going to give some general walkthrough with tips to get over stumbling blocks.

Required: XAMPP for windows or other WAMP. USE PHP 7.2 (SEVEN POINT TWO) VERSION!!!! Very important. 7.4 is not ready for primetime and your horde install will crash and burn if you try it. PHP 5.6+ also works.

Once you have xampp installed and running, you can prepare it for horde installation.

* Create a virtual host for your horde domain. This will be your webmail (a necessary requirement).

Code: Select all

<VirtualHost *:80>
    ServerAdmin admin@domain.com
    DocumentRoot "X:/xampp/htdocs/horde"
    ServerName horde.domain.net
    ServerAlias horde.domain2.com
    ServerAlias horde.domain3.com
	RewriteEngine On
	RewriteCond %{HTTPS} off
	RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
    ErrorLog "logs/horde.domain.net-error.log"
    CustomLog "logs/horde.domain.net-access.log" common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin admin@domain.com
    DocumentRoot "X:/xampp/htdocs/horde"
	SSLEngine on
	SSLCertificateFile "C:\xampp\certificates\horde.domain.net-crt.pem"
	SSLCertificateKeyFile "C:\xampp\certificates\horde.domain.net-key.pem"
	SSLCertificateChainFile "C:\xampp\certificates\horde.domain.net-chain.pem"
    ServerAlias horde.domain2.com
    ServerAlias horde.domain3.com
    ErrorLog "logs/horde.domain.net-error.log"
    CustomLog "logs/horde.domain.net-access.log" common
</VirtualHost>
* Create a virtual host for your email domain. This will be for your activesync autodiscover and redirects to horde.

Code: Select all

<VirtualHost *:80>
    ServerAdmin admin@domain.com
    DocumentRoot "X:/xampp/htdocs/emaildomain.net"
    ServerName emaildomain.net
	ServerAlias autodiscover.emaildomain.net
	Alias /rpc.php "X:/xampp/htdocs/horde/rpc.php"
	Alias /Microsoft-Server-ActiveSync "X:/xampp/htdocs/horde/rpc.php"
	Alias /autodiscover/autodiscover.xml "X:/xampp/htdocs/horde/rpc.php"
	Alias /Autodiscover/Autodiscover.xml "X:/xampp/htdocs/horde/rpc.php"
	Alias /AutoDiscover/AutoDiscover.xml "X:/xampp/htdocs/horde/rpc.php"
	RewriteEngine On
	RewriteCond %{HTTPS} off
	RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
    ErrorLog "logs/emaildomain.net-error.log"
    CustomLog "logs/emaildomain.net-access.log" common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin admin@domain.com
    DocumentRoot "X:/xampp/htdocs/emaildomain.net"
	SSLEngine on
	SSLCertificateFile "C:\xampp\certificates\emaildomain.net-crt.pem"
	SSLCertificateKeyFile "C:\xampp\certificates\emaildomain.net-key.pem"
	SSLCertificateChainFile "C:\xampp\certificates\emaildomain.net-chain.pem"
    ServerName emaildomain.net
	ServerAlias autodiscover.emaildomain.net
	Alias /rpc.php "X:/xampp/htdocs/horde/rpc.php"
	Alias /Microsoft-Server-ActiveSync "X:/xampp/htdocs/horde/rpc.php"
	Alias /autodiscover/autodiscover.xml "X:/xampp/htdocs/horde/rpc.php"
	Alias /Autodiscover/Autodiscover.xml "X:/xampp/htdocs/horde/rpc.php"
	Alias /AutoDiscover/AutoDiscover.xml "X:/xampp/htdocs/horde/rpc.php"
    ErrorLog "logs/emaildomain.net-error.log"
    CustomLog "logs/emaildomain.net-access.log" common
</VirtualHost>
* Create a database for horde.

Now restart apache and make sure your domains are working, even if they're just empty folders.

Instructions for installing horde webmail are here: https://www.horde.org/apps/webmail/docs/INSTALL

Its fairly straightforward. I guess you could do it from cmd terminal, but I used the terminal built into xampp. Launch the xampp-config app AS ADMINISTRATOR and click the shell button. Then change directory to php: cd php

Then just follow the instructions:

Code: Select all

pear channel-discover pear.horde.org
pear install horde/horde_role
pear run-scripts horde/horde_role
pear install -a -B horde/webmail
The last one is the most important because its the script that populates your horde database and gets you going. Be ready with the db information and path to the horde installation ("X:/xampp/htdocs/horde" in my case). The instructions simply say "webmail-install" but that script ain't gonna run itself, so use this instead:

Code: Select all

php webmail-install
When you get to "pear install -a -B horde/webmail", you WILL see errors but you can safely ignore them. This part takes a while because it has to find and download all the files. Be patient. Have a beer.

That's all there is. You can now log in to horde webmail and start manipulating the config, which is done through the web interface.

A couple of pointers:

Edit your windows hosts files to include your email and horde domains. This will allow for ssl to work with horde email. I'll get to that below.

You will NEED to authenticate horde via hmailserver. So in the config, under administration > configuration > horde > authentication, choose the following:
$conf[auth][driver] "Let a horde app handle authentication"
$conf[auth][params][app] "imp" is the mail app for horde.

Also in the config is a section for "IMAP Server". IGNORE THIS! It is actually a component for kolab, which you will not be using at all. In order to connect and deliver mail, you will need to configure a "backend" for IMP. Go to your install directory > \imp\config and copy backends.php and rename it backends.local.php. "Local" config files will not be overwritten when upgrading horde. Then delete everything in it and use this for simplicity's sake:

Code: Select all

<?php

$servers['advanced'] = array(
    'disabled' => false,
    'name' => 'emaildomain.net',
    'hostspec' => 'emaildomain.net',
    'hordeauth' => false,
    'protocol' => 'imap',
    'port' => 143,
    'secure' => 'tls',
    'smtp' => array(
       'port' => 587,
    ),
    'acl' => true,
    'cache' => false,
    'quota' => array(
        'driver' => 'imap',
        'params' => array(
            'hide_when_unlimited' => true,
            'unit' => 'MB'
        )
    ),
    'special_mboxes' => array(
        IMP_Mailbox::MBOX_DRAFTS => 'Drafts',
        IMP_Mailbox::MBOX_SENT => 'Sent',
        IMP_Mailbox::MBOX_SPAM => 'Spam',
        // IMP_Mailbox::MBOX_TEMPLATES => 'Templates',
        IMP_Mailbox::MBOX_TRASH => 'Trash',
        // IMP_Mailbox::MBOX_USERSPECIAL => array(
		//    'Example' => _("Example Special Mailbox")
		// )
    ),
    'autocreate_special' => false
);
There are other features you can enable, but this should get you going out of the box. And here you can see that I did NOT use localhost for mail - I used the domain in order to facilitate proper certificate verification. That's why we modified the windows hosts file.

Lastly, enable activesync under the activesync tab in horde configuration. Choose all the defaults. Enable logging if you want, but the logs grow YUUUUUGE very quickly.

Now try to connect using windows 10 mail or some other mail client that can connect with activesync. Do a manual setup using exchange server. If it works, GREAT! You're all set. If not, then it probably has something to do with your apache virtual hosts. Make sure the paths to rpc.php are correct. If that doesn't work, then report here and we'll try to troubleshoot.

Speaking of troubleshooting, do not try to enable autodiscover until everything else is working. It should work right away with the virtual hosts I posted above, but it complicates troubleshooting if you have other issues.

Enjoy!

Post Reply