Prerequisites:

– 1 database (mysql)
– 1 user associated with the database
– Follow this tutorial to set up apache2 and a virtual host

For this tutorial, the document root will be in /srv/horde

Sample config files will be in /tmp/horde

Copy the content below to /tmp/horde/horde.conf.php

<?php
/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
// $Id: 56a06c9745abf383eb7381c3efc537045bf0ba0c $
$conf['vhosts'] = false;
$conf['debug_level'] = E_ALL & ~E_NOTICE;
$conf['max_exec_time'] = 0;
$conf['compress_pages'] = true;
$conf['secret_key'] = '{{SECRET_KEY}}';
$conf['umask'] = 077;
$conf['testdisable'] = true;
$conf['use_ssl'] = 2;
$conf['server']['name'] = $_SERVER['SERVER_NAME'];
$conf['urls']['token_lifetime'] = 30;
$conf['urls']['hmac_lifetime'] = 30;
$conf['urls']['pretty'] = false;
$conf['safe_ips'] = array();
$conf['session']['name'] = 'Horde';
$conf['session']['use_only_cookies'] = true;
$conf['session']['timeout'] = 0;
$conf['session']['cache_limiter'] = 'nocache';
$conf['session']['max_time'] = 72000;
$conf['cookie']['domain'] = $_SERVER['SERVER_NAME'];
$conf['cookie']['path'] = '/';
$conf['sql']['username'] = '{{DB_USER}}';
$conf['sql']['password'] = '{{DB_PASS}}';
$conf['sql']['hostspec'] = '{{DB_HOST}}';
$conf['sql']['port'] = 3306;
$conf['sql']['protocol'] = 'tcp';
$conf['sql']['database'] = '{{DB}}';
$conf['sql']['charset'] = 'utf-8';
$conf['sql']['ssl'] = true;
$conf['sql']['splitread'] = false;
$conf['sql']['phptype'] = 'mysql';
$conf['nosql']['phptype'] = false;
$conf['ldap']['useldap'] = false;
$conf['auth']['admins'] = array('Administrator');
$conf['auth']['checkip'] = true;
$conf['auth']['checkbrowser'] = true;
$conf['auth']['resetpassword'] = true;
$conf['auth']['alternate_login'] = false;
$conf['auth']['redirect_on_logout'] = false;
$conf['auth']['list_users'] = 'list';
$conf['auth']['params']['username'] = 'Administrator';
$conf['auth']['params']['requestuser'] = false;
$conf['auth']['driver'] = 'auto';
$conf['auth']['params']['count_bad_logins'] = false;
$conf['auth']['params']['login_block'] = false;
$conf['auth']['params']['login_block_count'] = 5;
$conf['auth']['params']['login_block_time'] = 5;
$conf['signup']['allow'] = false;
$conf['log']['priority'] = 'INFO';
$conf['log']['ident'] = 'HORDE';
$conf['log']['name'] = LOG_USER;
$conf['log']['type'] = 'syslog';
$conf['log']['enabled'] = true;
$conf['log_accesskeys'] = false;
$conf['prefs']['params']['driverconfig'] = 'horde';
$conf['prefs']['driver'] = 'Sql';
$conf['alarms']['params']['driverconfig'] = 'horde';
$conf['alarms']['params']['ttl'] = 300;
$conf['alarms']['driver'] = 'Sql';
$conf['group']['driverconfig'] = 'horde';
$conf['group']['driver'] = 'Sql';
$conf['perms']['driverconfig'] = 'horde';
$conf['perms']['driver'] = 'Sql';
$conf['share']['no_sharing'] = false;
$conf['share']['auto_create'] = true;
$conf['share']['world'] = true;
$conf['share']['any_group'] = false;
$conf['share']['hidden'] = false;
$conf['share']['cache'] = false;
$conf['share']['driver'] = 'Sqlng';
$conf['cache']['default_lifetime'] = 86400;
$conf['cache']['params']['sub'] = 0;
$conf['cache']['driver'] = 'File';
$conf['cache']['use_memorycache'] = '';
$conf['cachecssparams']['url_version_param'] = true;
$conf['cachecss'] = false;
$conf['cachejsparams']['url_version_param'] = true;
$conf['cachejs'] = false;
$conf['cachethemes'] = false;
$conf['lock']['params']['driverconfig'] = 'horde';
$conf['lock']['driver'] = 'Sql';
$conf['token']['params']['driverconfig'] = 'horde';
$conf['token']['driver'] = 'Sql';
$conf['davstorage']['params']['driverconfig'] = 'horde';
$conf['davstorage']['driver'] = 'Sql';
$conf['mailer']['params']['sendmail_path'] = '/usr/lib/sendmail';
$conf['mailer']['params']['sendmail_args'] = '-oi';
$conf['mailer']['type'] = 'sendmail';
$conf['mailformat']['brokenrfc2231'] = false;
$conf['vfs']['params']['driverconfig'] = 'horde';
$conf['vfs']['type'] = 'Sql';
$conf['sessionhandler']['type'] = 'Builtin';
$conf['sessionhandler']['hashtable'] = false;
$conf['spell']['driver'] = '';
$conf['gnupg']['keyserver'] = array('pool.sks-keyservers.net');
$conf['gnupg']['timeout'] = 10;
$conf['nobase64_img'] = false;
$conf['image']['driver'] = false;
$conf['exif']['driver'] = 'Bundled';
$conf['timezone']['location'] = 'ftp://ftp.iana.org/tz/tzdata-latest.tar.gz';
$conf['problems']['email'] = 'webmaster@example.com';
$conf['problems']['maildomain'] = 'example.com';
$conf['problems']['tickets'] = false;
$conf['problems']['attachments'] = true;
$conf['menu']['links']['help'] = 'all';
$conf['menu']['links']['prefs'] = 'authenticated';
$conf['menu']['links']['problem'] = 'all';
$conf['menu']['links']['login'] = 'all';
$conf['menu']['links']['logout'] = 'authenticated';
$conf['portal']['fixed_blocks'] = array();
$conf['accounts']['driver'] = 'null';
$conf['user']['verify_from_addr'] = false;
$conf['user']['select_view'] = true;
$conf['facebook']['enabled'] = false;
$conf['twitter']['enabled'] = false;
$conf['urlshortener'] = false;
$conf['weather']['provider'] = false;
$conf['imap']['enabled'] = false;
$conf['imsp']['enabled'] = false;
$conf['kolab']['enabled'] = false;
$conf['hashtable']['driver'] = 'none';
$conf['activesync']['enabled'] = false;
/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */

Copy the content below to /tmp/horde/webmail-install.php
Note: this is the default content provided by Horde. I just commented the mysql configuration (line 31).

#!/usr/bin/env php
<?php
/**
 * This script finishes the installation of Horde Groupware Webmail Edition.
 */

// Enable error reporting.
$error_level = E_ALL & ~E_STRICT;
if (defined('E_DEPRECATED')) {
    $error_level &= ~E_DEPRECATED;
}
ini_set('error_reporting', $error_level);
ini_set('display_errors', 1);

require_once 'PEAR/Config.php';
require_once PEAR_Config::singleton()
    ->get('horde_dir', null, 'pear.horde.org') . '/lib/Application.php';

// Load the CLI environment.
$cli = Horde_Core_Cli::init();
if (!$cli->runningFromCLI()) {
    $cli->fatal('This script must be run from the command line.');
}

// Start.
$cli->writeln();
$cli->writeln($cli->yellow($cli->bold('Installing Horde Groupware Webmail Edition')));

$bundle = new Horde_Bundle($cli);
$bundle->init();
//$bundle->configDb();
$bundle->migrateDb();
$bundle->writeAllConfigs();
$bundle->configAuth();

// Finished.
$cli->writeln();
$cli->writeln($cli->yellow($cli->bold('Thank you for using Horde Groupware Webmail Edition!')));
$cli->writeln();

Create the bash script that will automate the installation

#Generate random secret key
SK=${cat /dev/urandom | tr -dc 'a-zA-Z0-9-' | fold -w 60 | head -n 1}

#Horde user host
MYSQL_HOST="localhost"
#Horde user
MYSQL_USER="YOUR_USER"
#Horde password
MYSQL_PASSWORD="YOUR PASSWORD"
#Horde database
MYSQL_HORDE_DATABASE="horde"

sed -i "s/{{SECRET_KEY}}/$SK/g" /tmp/horde/horde.conf.php
sed -i "s/{{DB_HOST}}/$MYSQL_HOST/g" /tmp/horde/horde.conf.php
sed -i "s/{{DB_USER}}/$MYSQL_USER/g" /tmp/horde/horde.conf.php
sed -i "s/{{DB_PASS}}/$MYSQL_PASSWORD/g" /tmp/horde/horde.conf.php
sed -i "s/{{DB}}/$MYSQL_HORDE_DATABASE/g" /tmp/horde/horde.conf.php

#Register the horde pear channel
pear channel-discover pear.horde.org

#Setup the installation folder
pear install horde/horde_role
echo -e "/srv/horde\n" | pear run-scripts horde/horde_role

#Create the config directory
mkdir -p /srv/horde/config
cp /tmp/horde/horde.conf.php /srv/horde/config/conf.php
cp /tmp/horde/webmail-install.php /usr/bin/webmail-install

#Start the installation
pear install -a -B horde/webmail
cp -R /tmp/horde/usr/bin/* /usr/bin
echo -e "\n" | webmail-install
chown -R www-data:www-data /srv/horde/*
Categories: DiversLinux

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *