Horde

From Indie IT Wiki

HOWTO: Set Preferred Language

horde/config/prefs.php

// user language
$_prefs['language'] = array(
    'value' => 'en_GB',
    'locked' => true,
    'shared' => true,
    'type' => 'select',
    'escaped' => true,
    'desc' => _("Select your preferred language:")
);

UPDATE: February / March 2013: Horde 5 (latest): Manual Install on Gentoo Linux

https://github.com/horde/horde/blob/master/horde/docs/INSTALL

Framework

PHP Tweaks

Make sure PHP has the following USE flags, especially ssl...

dev-lang/php apache2 cgi ctype curl ftp gd hash imap ldap mysql nls pcre pdo session simplexml ssl unicode xml

Reinstall PHP

emerge -q dev-lang/php

Install PEAR

echo "dev-php/pear ~amd64" >>/etc/portage.package.keywords
echo "dev-php/PEAR-PEAR ~amd64" >>/etc/portage.package.keywords
emerge pear
nano /usr/bin/pear   (change to -d memory_limit=128M)

Check PEAR Version

pear -V

PEAR Version: 1.9.4
PHP Version: 5.4.4--pl0-gentoo
Zend Engine Version: 2.4.0
Running on: Linux vmware-gentoo-server 3.3.8-gentoo #6 SMP Mon Feb 11 17:20:35 GMT 2013 x86_64

Upgrade PEAR Internally

pear upgrade

Install Horde Framework

pear channel-discover pear.horde.org
pear install horde/horde_role
pear run-scripts horde/horde_role
Filesystem location for the base Horde application : /var/www/localhost/htdocs/horde/
pear install -a -B horde/horde

Make Configuration Files And Tweak Web Server Permissions

cd /var/www/localhost/htdocs/horde/config/
for f in *.dist; do cp $f `basename $f .dist`; done
nano conf.php   (change $conf['testdisable'] = false;)
chown -R apache:apache /var/www/localhost/htdocs/horde/config/

Testing

Load the Horde test page...

http://192.168.0.x/horde/test.php

The, load the actual Horde main page...

http://192.168.0.x/horde/

Configuration

Configure Horde...

Click on the COG > Administration > Configuration > Horde (horde) 5.0.4

Set up MYSQL backend...

$ mysql -u root -p
CREATE DATABASE horde;
GRANT ALL ON horde.* TO horde@localhost IDENTIFIED BY 'horde';
FLUSH PRIVILEGES;
exit;

Download 'horde_create_mysql.sql' file and import it into MySQL...

wget https://raw.github.com/wrobel/horde-fw3/master/scripts/sql/create.mysql.sql
mysql -u root -p horde < horde_create_mysql.sql

Set up Database...

Configuration > Database

$conf[sql][phptype] MySQL / PDO
$conf[sql][username] horde
$conf[sql][password] horde
$conf[sql][protocol] TCP/IP
$conf[sql][hostspec] localhost
$conf[sql][port] 3306
$conf[sql][database] horde

Set up Authentication...

In this example we are authenticating with IMAP...

$conf[auth][admins] Administrator, userjoesmith
$conf[auth][driver] IMAP
$conf[auth][params][hostspec] localhost
$conf[auth][params][port] 143
$conf[auth][params][secure] none

Click the big black Generate Horde Configuration button!

Then update the Database Schemas in all cases...

Configuration > Update All DB Schemas

IMP Email

Prerequisites

Add SSL and TLS to the Dovecot IMAP server software...

echo "net-mail/dovecot ssl" >>/etc/portage/package.use
emerge -1q dovecot
nano /etc/dovecot/conf.d/*
/etc/init.d/dovecot restart

Installation

pear install -a -B horde/imp

Configuration

Create the config files...

cd /var/www/localhost/htdocs/horde/imp/config/
for f in *.dist; do cp $f `basename $f .dist`; done

Fix the directory permissions...

chown -R apache:apache /var/www/localhost/htdocs/horde/imp/config/
chmod g+w /var/www/localhost/htdocs/horde/imp/config/

Edit the email servers...

cd /var/www/localhost/htdocs/horde/imp/config/
cp -av backends.php backends.local.php
nano backends.local.php

<?php
$servers['imap'] = array(
   // ENABLED by default
   'disabled' => false,
   'name' => 'IMAP Server',
   'hostspec' => 'localhost',
   'hordeauth' => 'false',
   'protocol' => 'imap',
   'port' => 143,
   // Plaintext logins are disabled by default on IMAP servers (see RFC 3501
   // [6.2.3]), so TLS is the only guaranteed authentication available by
   // default.
   'secure' => 'tls',
   'maildomain' => ,
   'smtp' => array(
       'auth' => true,
       'localhost' => 'localhost',
       'host' => 'localhost',
       'password' => null,
       'port' => 25,
       'username' => null
   ),
   'cache' => false,
);

Permissions

You have to allow users to use IMP.

Administraion > Permissions > + Add New Permission > Mail (imp)
> All Authenticated Users > Show | Read | Edit Delete

Change Horde Authentication

Now change Horde so that it authenticates using another Horde service, otherwise you will have to log in twice.

Administration > Configuration > Horde > Authentication
> $conf[auth][driver] > Let a Horde Application handle authentication > imp

Logout and log back in again.

Viewing Mail

Now click on the new Mail link at the top of the screen next to the cog :)

Kronolith Calendar + Nag Tasks

Installation

pear install -a -B horde/kronolith

Configuration

Create the config files...

cd /var/www/localhost/htdocs/horde/kronolith/config/
for f in *.dist; do cp $f `basename $f .dist`; done
cd /var/www/localhost/htdocs/horde/nag/config/
for f in *.dist; do cp $f `basename $f .dist`; done

Fix the directory permissions...

chown -R apache:apache /var/www/localhost/htdocs/horde/kronolith/config/
chmod g+w /var/www/localhost/htdocs/horde/kronolith/config/
chown -R apache:apache /var/www/localhost/htdocs/horde/nag/config/
chmod g+w /var/www/localhost/htdocs/horde/nag/config/

Error: A Fatal Error Has Occurred:

Error...

HORDE: Class Horde_Compress_Fast does not exist [pid 1571 on line 60 of "/usr/share/php/Horde/Injector/Binder/Implementation.php"]

Fix...

pear install -a -B horde/Horde_Compress_Fast
/etc/init.d/apache2 restart

UPDATE: October 2012: Horde + PHP 5.3.x

If you upgrade to PHP 5.3 from PHP 5.2, Horde will not work.

Don’t be tricked by these errors in log:

[error] [client ....] PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/share/psa-pear/PEAR.php

the errors can be disabled in /usr/share/psa-horde/config/conf.php

If you get white page [500 error] after login on horde you can try this:

Edit files:

/usr/share/psa-horde/imp/lib/IMAP/Client.php line 576
modify     function namespace($additional = array())
with       function plnamespace($additional = array())
/usr/share/psa-horde/imp/lib/Session.php line 295
modify     $_SESSION['imp']['namespace'] = $imapclient->namespace($user_namespace);
with       $_SESSION['imp']['namespace'] = $imapclient->plnamespace($user_namespace);

Reload the webmail page and logout/login again.

http://kb.toderu.ro/2011/05/12/how-to-fix-plesk-horde-after-upgrade-to-php-5-3/

http://forums.freebsd.org/showthread.php?t=21572

http://tinyurl.com/9yy8mjp

Introduction

The Horde Project is a collection of open source software - web applications written in PHP for group-based communication and collaboration.

http://www.horde.org

Using lighttpd Instead of Apache

emerge lighttpd
n /etc/vhosts/webapp-config
vhost_server="lighttpd"
webapp-config -I -d horde -u lighttpd horde 3.3.11

.htaccess Password Protection

/etc/lighttpd/lighttpd.conf

server.modules = (
    "mod_access",
    "mod_auth",

...

$HTTP["remoteip"] !~ "(127.0.0.1|192.168.0.*)" {
auth.debug = 2
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd"
auth.require = ( "/horde/" =>
                 (
                   "method" => "basic",
                   "realm" => "Webmail Access",
                   "require" => "valid-user",
                 )
               )
}

Installation on Gentoo Linux

This guide will install the basic Horde framework, the IMP email application, the Turba Address Book application, the Kronolith Calendar application and the Vacation out-of-office reply software.

PHP

UPDATE: August 2011

You will need to hard mask versions of PHP greater than 5.2, because PHP 5.3 does not work with Horde.

echo ">dev-lang/php-5.2.17" >> /etc/portage/package.mask

Check PHP requirements are met...

nano /etc/portage/package.use

...and add or edit the line making sure you add cgi, ftp, imap and ldap use flags...

dev-lang/php apache2 cgi ctype curl ftp gd hash imap ldap mysql nls pcre pdo session simplexml unicode xml

...then reinstall PHP

emerge -1q php

Apache

Restart Apache web server

/etc/init.d/apache2 restart

IMP

Install the Horde IMP Email software. This will also install the PEAR and Horde Framework

emerge -q horde-imp

Enable the Horde test PHP page

chmod 0644 /var/www/localhost/htdocs/horde/test.php

Create the config files for both Horde and IMP

cd /var/www/localhost/htdocs/horde/config/
for f in *.dist; do cp $f `basename $f .dist`; done
cd /var/www/localhost/htdocs/horde/imp/config/
for f in *.dist; do cp $f `basename $f .dist`; done

Fix the directory permissions

chown -R apache:apache /var/www/localhost/htdocs/horde/config/
chown -R apache:apache /var/www/localhost/htdocs/horde/imp/config/

Edit the email servers file

nano /var/www/localhost/htdocs/horde/imp/config/servers.php
...
$servers['imap'] = array(
    'name' => 'IMAP Server',
    'server' => 'localhost',
    'hordeauth' => false,
    'protocol' => 'imap/notls',
    'port' => 143,
    'maildomain' => 'yourdomain.com',
    'smtphost' => 'localhost',
    'smtpport' => 25,
    'realm' => '',
    'preferred' => '',
 );

Test the Horde framework by loading this web page

http://address.of.your.server/horde/test.php

Configure by loading this web page

http://address.of.your.server/horde/
  1. Administration --> Setup --> Application: Horde (horde)
  2. Authentication --> $conf[auth][admins] --> [Administrator, regularUserName]
  3. Authentication --> $conf[auth][driver] --> [Let a Horde application handle authentication]
  4. Mailer --> $conf[mailer][type] --> [Use a SMTP server]
  5. Mailer --> $conf[mailer][params][auth] --> [No authentication]
  6. Click [Generate Horde Configuration] button
  7. Administration --> Setup --> Application: Mail (imp)
  8. Click [Generate Mail Configuration] button

Forwards

Download the Horde Forwards application module

wget http://ftp.horde.org/pub/forwards/forwards-latest.tar.gz

Extract the tarball to the correct directory

tar -xzvf forwards-latest.tar.gz -C /var/www/localhost/htdocs/horde/

Change the directory name

cd /var/www/localhost/htdocs/horde/
mv forwards-h3-3.2.1/ forwards

Fix the permissions

chown -R apache:apache forwards/config/

or

chown -R lighttpd:lighttpd forwards/config/

Configure by loading this web page

http://address.of.your.server/horde/
  1. Administration --> Setup --> Application: Forwards (forwards)
  2. Click [Generate Forwards Configuration] button

Vacation

Set up the sendmail smrsh facility for the vacation binary

cd /usr/adm/sm.bin/
ln -s /usr/bin/vacation

Install the FTP server needed

emerge -q proftpd

Configure and start the FTP server

cp -av /etc/proftpd/proftpd.conf.sample /etc/proftpd/proftpd.conf
nano /etc/proftpd/proftpd.conf
     #UseIPv6 off
     DefaultRoot ~
rc-update add proftpd default
/etc/init.d/proftpd start

Download the Horde Vacation application module

wget http://ftp.horde.org/pub/vacation/vacation-h3-3.2.1.tar.gz

Extract the tarball to the correct directory

tar -xzvf vacation-h3-3.2.1.tar.gz -C /var/www/localhost/htdocs/horde/

Change the directory name

cd /var/www/localhost/htdocs/horde/
mv vacation-h3-3.2.1/ vacation

Fix the permissions

chown -R apache:apache vacation/config/
or
chown -R lighttpd:lighttpd vacation/config/

Configure by loading this web page

http://address.of.your.server/horde/
  1. Administration --> Setup --> Application: Vacation (vacation)
  2. Vacation Settings --> $conf[vacation][from] --> Untick Allow users to change email sender
  3. Click [Generate Vacation Configuration] button

Turba Address Book

Install OpenLDAP

emerge -q openldap
rc-update add slapd default

Edit the configuration file.

nano /etc/openldap/slapd.conf
...
include         /etc/openldap/schema/horde.schema
...
access to dn.subtree="ou=addressbook,dc=domain,dc=uk,dc=com"
       by users write
       by * read
access to *
       by * read

Start OpenLDAP

/etc/init.d/slapd start

Populate the database. Create a text file called database.ldif with examples like the following:-

# Entry 1: dc=domain,dc=uk,dc=com
dn: dc=domain,dc=uk,dc=com
dc: domain
o: Domain
objectclass: dcObject
objectclass: organization

# Entry 2: cn=root,dc=domain,dc=uk,dc=com
dn: cn=root,dc=domain,dc=uk,dc=com
cn: root
objectclass: organizationalRole

# Entry 3: ou=addressbook,dc=domain,dc=uk,dc=com
dn: ou=addressbook,dc=domain,dc=uk,dc=com
objectclass: top
objectclass: organizationalUnit
ou: addressbook

# Entry 4: cn=John Smith,ou=addressbook,dc=domain,dc=uk,dc=com
dn: cn=John Smith,ou=addressbook,dc=domain,dc=uk,dc=com
cn: John Smith
givenname: John
homephone: 01234 567890
mail: john@smith.cc.com
mobile: 07777 777777
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
sn: Smith

# Entry 5: cn=Paul Jones,ou=addressbook,dc=domain,dc=uk,dc=com...
dn: cn=Paul Jones,ou=addressbook,dc=domain,dc=uk,dc=com
cn: Paul Jones
facsimiletelephonenumber: 08719 896021
givenname: Paul
homephone: 03333 333333
l: Folkestone
mail: paul@jones.me.com
mobile: 07777 111222
objectclass: inetOrgPerson
objectclass: top
objectclass: person
objectclass: organizationalPerson
postalcode: ZZ20 1ZZ
sn: Domain
st: Kent
street: 17 Fishing Market, The Street
telephonenumber: 01234 567890 

# Entry 6: ou=users,dc=domain,dc=uk,dc=com
dn: ou=users,dc=domain,dc=uk,dc=com
objectclass: top
objectclass: organizationalUnit
ou: users

# Entry 7: cn=pjones,ou=users,dc=domain,dc=uk,dc=com
dn: cn=pjones,ou=users,dc=domain,dc=uk,dc=com
cn: pjones
cn: paulj
displayname: Paul Jones
gidnumber: 100
givenname: Paul
homedirectory: /home/pjones
loginshell: /bin/bash
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: top
sn: Domain
uid: pjones
uidnumber: 1000
userpassword: {CRYPT}nSLjvi76PydXQ

Then add them to the database

slapadd -l database.ldif

Check / Add The PHP USE Flag

nano /etc/portage/package.use
...
dev-lang/php ldap

Reinstall PHP

emerge -1q dev-lang/php

Install Horde Turba

emerge -q www-apps/horde-turba

Create config files

cd /var/www/localhost/htdocs/horde/turba/config/
for f in *.dist; do cp $f `basename $f .dist`; done

Fix the directory permissions

chown -R apache:apache /var/www/localhost/htdocs/horde/turba/config/

Configure by loading this web page

http://address.of.your.server/horde/
  1. Administration --> Setup --> Application: Address Book (horde)

Configure the /var/www/localhost/htdocs/horde/turba/config/sources.php file

/**
* A local address book in an LDAP directory. This implements a public
* (shared) address book.
*
*/
$cfgSources['localldap'] = array(
   'title' => _("Shared LDAP Address Book"),
   'type' => 'ldap',
   'params' => array(
       'server' => 'localhost',
       'port' => 389,
       'tls' => false,
       'root' => 'ou=addressbook,dc=domain,dc=uk,dc=com',
       'bind_dn' => 'cn=root,dc=domain,dc=uk,dc=com',
       'bind_password' => 'mypassword',
       'sizelimit' => 200,
       'dn' => array('cn'),
       'objectclass' => array('top',
                              'person',
                              'organizationalPerson',
                              'inetOrgPerson'),
       'scope' => 'one',
       'charset' => 'utf-8',
       'checkrequired' => false,
       'checkrequired_string' => ' ',
       'checksyntax' => false,
       'version' => 3,
   ),
   'map' => array(
       '__key' => 'dn',
       '__uid' => 'uid',
       'firstname' => 'givenname',
       'lastname' => 'sn',
       'name' => 'cn',
       'email' => 'mail',
       'homePhone' => 'homephone',
       'workPhone' => 'telephonenumber',
       'cellPhone' => 'mobile',
       'homeStreet' => 'street',
       'homeCity' => 'l',
       'homeProvince' => 'st',
       'homePostalCode' => 'postalcode',
   ),
   'search' => array(
       'firstname',
       'lastname',
       'name',
       'email',
       'homePhone',
       'workPhone',
       'cellPhone',
       'homeStreet',
       'homeCity',
       'homeProvince',
       'homePostalCode',
   ),
   'strict' => array(
       'dn',
   ),
   'approximate' => array(
       'cn',
   ),
   'export' => true,
   'browse' => true,
);

Kronolith Calendar

Install the software

emerge -q www-apps/horde-kronolith

Create working copies of the configuration files

cd /var/www/localhost/htdocs/horde/kronolith/config/
for foo in *.dist; do cp $foo `basename $foo .dist`; done

Fix the directory permissions

cd /var/www/localhost/htdocs/horde/kronolith/
chown -R apache:apache config/
chmod g+w config/

Create the MySQL database

mysql -u root -p
<enter password>
create database horde;
grant all privileges on horde.* to 'horde'@'localhost' identified by 'horde';
flush privileges;
exit;

Create the MySQL database tables

cd /var/www/localhost/htdocs/horde/kronolith/scripts/sql/
mysql -u root -p horde < kronolith.mysql.sql 

Configure by loading this web page

http://address.of.your.server/horde/

Log in and change these settings:-

  1. Administration --> Setup --> Application: Horde (horde)
  2. Database --> $conf[sql][phptype] --> MySQL
  3. Database --> $conf[sql][username] --> horde
  4. Database --> $conf[sql][password] --> horde
  5. Database --> $conf[sql][protocol] --> UNIX Sockets
  6. Database --> $conf[sql][database] --> horde
  7. Database --> $conf[sql][charset] --> utf-8
  8. Database --> $conf[sql][splitread] --> Disabled
  9. Click [Generate Horde Configuration] button
  10. Administration --> Setup --> Application: Calendar (kronolith)
  11. Reminder Settings --> $conf[reminder][server_name] --> 127.0.0.1
  12. Reminder Settings --> $conf[reminder][from_addr] --> server@127.0.0.1
  13. Click [Generate Calendar Configuration] button

Groupware

This will install all the Horde software in one go.

First, if you have already installed the 'separate' packages shown above, then remove them (but leave PHP and horde-pear)...

emerge --unmerge www-apps/horde-turba www-apps/horde-kronolith www-apps/horde-imp www-apps/horde

The, install the meta package...

emerge www-apps/horde-groupware

To finish the installation of Horde Groupware and configure the application, please run...

cd /var/www/localhost/htdocs/horde/
php scripts/setup.php

You will be asked the following questions...

What is the web root path on your web server for this installation, i.e. 
the path of the address you use to access Horde Groupware in your browser? [/horde] 

Horde Groupware Configuration Menu 
   (0) Exit
   (1) Configure database settings
   (2) Create database or tables
   (3) Configure administrator settings
   (4) Update PEAR for a new or changed location
   (5) Update from an older Horde Groupware version

Type your choice: 1
What database backend should we use? [false] 
   (false) [None]
   (dbase) dBase
   (ibase) Firebird/InterBase
   (fbsql) Frontbase
   (ifx) Informix
   (msql) mSQL
   (mssql) MS SQL Server
   (mysql) MySQL
   (mysqli) MySQL (mysqli)
   (oci8) Oracle
   (odbc) ODBC
   (pgsql) PostgreSQL
   (sqlite) SQLite
   (sybase) Sybase

Type your choice: mysql
Request persistent connections? [0] 
   (1) Yes
   (0) No

Type your choice: 0

Username to connect to the database as* [] horde

Password to connect with [] horde
How should we connect to the database? [unix] 
   (unix) UNIX Sockets
   (tcp) TCP/IP

Type your choice: unix

Location of UNIX socket [] 

Database name to use* [] horde

Internally used charset* [utf-8] 
Use SSL to connect to the server? [0] 
   (1) Yes
   (0) No

Type your choice: 0

Certification Authority to use for SSL connections [] 
Split reads to a different server? [false] 
   (false) Disabled
   (true) Enabled

Type your choice: false

Writing main configuration file
Done configuring database settings.