How to Install and configure Horde Webmail Client?

DeeKay August 29, 2011 at 7:05 pm · Linux

Below steps shows how to install and configure Horde Webmail Client-

Horde Groupware Webmail Edition is a free, enterprise ready, browser based communication suite. Users can read, send and organize email messages and manage and share calendars, contacts, tasks and notes with the standards compliant components from the Horde Project.
STEP 1: Use system-config-network-tui to set up IP, Net mask and Gateway:

# system-config-network-tui

STEP 2: Edit /etc/sysconfig/network and set your hostname:

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=server1.kodehelp.co.in
Save and exit file. Now, run # hostname server1.kodehelp.co.in

STEP 3: Edit /etc/resolv.conf and add your DNS servers:

nameserver 10.20.30.40

nameserver 20.30.40.50

STEP 4: Edit /etc/hosts to something like this, according to your system settings:

# vim /etc/hosts

# Do not remove the following line, or various programs that require network functionality will fail.

127.0.0.1
localhost.localdomain
localhost
192.168.100.1
server1.kodehelp.co.in
server1

::1
localhost6.localdomain6
localhost6
Save and exit file.

STEP 5: Restart network: ( Also you need to restart your system )

# service network restart

STEP 6: Prerequisites for Installation,

You need to enable EPEL, rpmforge repository to install required software.

# yum install -y gettext httpd mysql mysql-server dovecot sendmail* perl

# yum install -y php php-mysql php-xml php-imap php-mbstring php-mcrypt php-pecl-Fileinfo php-pecl-memcache  php-pear-DB php-pear-File php-pear-Log php-pear-Mail-Mime php-pear-Auth-SASL php-pear-Date  php-pear-HTTP-Request php-pear-Mail php-pear-Net-Sieve php-pear-Net-Socket php-pear-Net-SMTP  php-pear-MDB2-Driver-mysql php-gd php-xmlrpc php-soap php-pecl-json php-pear-Date-Holidays php-devel gcc
# yum install -y openssl mod_ssl crypto-utils perl-Net-SSLeay

STEP 7: Configuring Sendmail as a MTA and Dovecot as a POP3/IMAP server,

Sendmail Configuration

# vim /etc/mail/sendmail.mc

Add / Enable / comment out below lines,

define(`confSMTP_LOGIN_MSG’, `$j Sendmail; $b’)dnl

dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl

FEATURE(`accept_unresolvable_domains’)dnl

Save and exit sendmail.mc file.
# vim /etc/mail/access and enter your system IP to relay mails like,

192.168.100.1
RELAY
# vim /etc/mail/local-host-names

server1.kodehelp.co.in

save and exit all files and run

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

# service sendmail restart

Now your SMTP server is running, you can send emails to out side domains if port 25 is unblocked from your ISP.

STEP 8: Dovecot configuration, enable below lines to /etc/dovecot.conf.

protocols = imap pop3

login_dir = /var/run/dovecot/login

login_chroot = yes

login_user = dovecot

login_greeting = Dovecot ready.

protocol imap {

login_executable = /usr/libexec/dovecot/imap-login

mail_executable = /usr/libexec/dovecot/imap

}

protocol pop3 {

login_executable = /usr/libexec/dovecot/pop3-login
mail_executable = /usr/libexec/dovecot/pop3

pop3_enable_last = no

pop3_uidl_format = %08Xu%08Xv

}

auth_executable = /usr/libexec/dovecot/dovecot-auth

auth_process_size = 256

auth_cache_negative_ttl = 3600

Save and exit dovecot configuration file.

# service dovecot restart; chkconfig dovecot on

Note: If using CentOS x86_64 temporary fix for this bug by editing /etc/dovecot.conf,

login_process_size = 64

Restart Apache Server, MySQL Database server

# service httpd restart; chkconfig httpd on

# service mysqld restart; chkconfig mysqld on

STEP 9: Configure mysqld root password:

# /usr/bin/mysqladmin -u root password ‘your-password’

# /usr/bin/mysqladmin -u root -h server1.kodehelp.co.in password ‘your-password’

Now we have everything ready for Horde Installation.

STEP 10: Download Horde Groupware Webmail Edition and extract it. Get the latest stable version of Horde Groupware Webmail Edition from http://www.horde.org/download/app/?app=webmail.

Extract files and rename folder:

#tar zxf horde-webmail-*.tar.gz -C /var/www/html/

#mv /var/www/html/horde-*/ /var/www/html/horde/

# cd /var/www/html/horde/scripts/

./setup.php

Follow mentioned steps to successfully install horde. Now, create user horde in MySQL and grant horde DB the proper permissions,
STEP 11: Edit a text file and change the password for the same as in Step 1 above:

# mysql

mysql > REPLACE INTO user (host, user, password)

->VALUES (‘localhost’, ‘horde’, PASSWORD(‘password_for_horde_user’)

->);

mysql >REPLACE INTO db (host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv, index_priv)  VALUES ( ‘localhost’, ‘horde’, ‘horde’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’, ‘Y’);

mysql > FLUSH PRIVILEGES;

Save the file as hordeuser.mysql (or something else) and load it as mysql stdin:

# mysql –user=root –password=mysqlrootpassword < createuser.mysql

STEP 12: Edit PHP configuration as below:

# vim /etc/php.ini

php_admin_flag safe_mode off

php_admin_flag magic_quotes_runtime off

php_flag session.use_trans_sid off

php_flag session.auto_start off

php_admin_flag file_uploads on

php_admin_flag allow_url_fopen on

php_admin_value open_basedir   “/var/www/html/horde:/var/www/html/horde/config:/usr/share/pear:/tmp”

php_admin_flag register_globals off

# If horde dies while trying to handle large email file attachments, you are probably hitting PHP’s memory limit. Raise that limit here, but use caution. Set to your preference - memory_limit should be at least 32M and be greater than the value set for post_max_size

#php_value memory_limit 32M

#php_value post_max_size 20M

#php_value upload_max_filesize 10M

STEP 13: Finally, Configure Apache and PHP, add a “horde.conf” file to /etc/httpd/conf.d:

#

# Horde

#

Alias /horde /var/www/html/horde

<Directory /var/www/html/horde>

# Uncomment the following 3 lines to make Horde locally accessible only

#Order Deny,Allow

#Deny from all

#Allow from 127.0.0.1

Options +FollowSymLinks

</Directory>

<Directory /var/www/html/horde/config>

Order Deny,Allow

Deny from all

</Directory>

# Deny access to files that are not served directly by the web server

<DirectoryMatch “^/var/www/html/horde/(.*/)?(config|lib|locale|po|scripts|templates)/(.*)?”>

Order Deny,Allow

Deny from all

</DirectoryMatch>

# Deny access to the test.php files except from localhost

<LocationMatch “^/horde/(.*/)?test.php”>

Order Deny,Allow

Deny from all

Allow from 127.0.0.1

</LocationMatch>

Change horde.conf permission:

# chmod 0644 -v /etc/httpd/conf.d/horde.conf

Increase memory_limit option in /etc/php.ini to 64MB or higher (128MB is recommended):

memory_limit = 64M

Restart httpd:

# service httpd restart

Now, Open the following address in your browser: http://server1.kodehelp.co.in/horde/test.php

Security configuration

Secure config files:

chown apache:root -R /var/www/html/horde/config

chown apache:root -R /var/www/html/horde/*/config

chmod -R go-rwx /var/www/html/horde/config

chmod -R go-rwx /var/www/html/horde/*/config
Secure scripts:

chown -R root:root /var/www/html/horde/scripts

chown -R root:root /var/www/html/horde/*/scripts

chmod -R go-rwx /var/www/html/horde/scripts

chmod -R go-rwx /var/www/html/horde/*/scripts

Secure test.php:

chmod a-rwx /var/www/html/horde/test.php

chmod a-rwx /var/www/html/horde/*/test.php

Finishing configuration

Open http://server1.kodehelp.co.in/horde in your browser and log into horde with the administrator horde user,