Categories: DiversLinux

How To automate Horde Groupware Webmail installation

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/*
The GrimmChester

Share
Published by
The GrimmChester

Recent Posts

How to set up a SIP trunk with FreePBX and Twilio

FreePBX Server Requirements FreePBX 14.0 Asterisk 13 1 Twilio Number Mine will be (579)123-1234 Notes:…

8 years ago

Automated Web Hosting Solution (AWHS)Panel

Requirements For now, AWHSPanel only supports Debian 8 but its architecture allows easy new implementations.…

9 years ago

How to install ioncube on Debian & Ubuntu

ionCube installation What is ionCube: ionCube helps you to protect your PHP code from being…

10 years ago

Comment rediriger un site HTTP vers HTTPS

RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

10 years ago

How To Install Linux, Nginx, MySQL, PHP (LEMP) on Debian 8

Files Structure: /srv /mydomain.com /.socks /www /cgi-bin /logs /public_html /ssl /tmp /blog /cgi-bin /logs /public_html…

10 years ago

How To install the latest version of phpMyAdmin automatically on Linux

1. Virtual Host If you need to create a Virtual Host on Apache2 I recommend…

10 years ago