Introduction

In this tutorial, we will guide you on how to install Horde webmail groupware on Ubuntu Server. Horde is a free and open-source software framework that allows users to manage email, calendars, and contact lists. The installation process will take you through the installation and configuration process for using Horde to manage your email.

Prerequisites

Step 1: Update the system

We will begin by updating our system's package index and installing any available updates. Open the terminal and run the following command.

sudo apt-get update && sudo apt-get upgrade -y

Step 2: Install LAMP stack

Horde requires the Apache web server, MySQL database server, and PHP scripting language to operate. We will install the LAMP stack by running the following command.

sudo apt-get install apache2 mysql-server php php-mysql php-ldap php-imap php-mbstring libapache2-mod-php -y

Step 3: Create a MySQL Database

Next, we will create a database for our Horde installation. Launch the MySQL client by running the following command.

sudo mysql -u root -p

You will be prompted for your MySQL root password. Enter it to continue.

Create a new database and a user with full privileges by running the following commands:

CREATE DATABASE horde_db;
CREATE USER 'horde_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON horde_db.* TO 'horde_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Note: Replace ‘horde_db’, ‘horde_user’ and ‘password’ with your database, user and password respectively.

Step 4: Install required Horde packages

We need to install a few packages that are required by Horde. Run the following command to install them.

sudo apt-get install imp4 php-net-ldap2 php-net-sieve ingo4 php-crypt-blowfish -y

Step 5: Download and Install Horde

We will download the latest version of Horde from the official website.

First, create a directory for Horde by running the following command.

sudo mkdir -p /var/www/horde.example.com/

Next, download the latest version of Horde by running the command.

cd /var/www/horde.example.com/
sudo wget https://www.horde.org/download/imp/imp-6.2.40.tar.gz
sudo tar -xvf imp-6.2.40.tar.gz
sudo mv imp-6.2.40 /var/www/horde.example.com/

Step 6: Configure Horde

Once we have downloaded and installed Horde, we will now configure it by running the following commands.

cd /var/www/horde.example.com/imp-6.2.40/config/
sudo cp conf.xml.dist conf.xml
sudo nano conf.xml

Change the following parameters in the conf.xml file as per your preference.

<type>mysqli</type>
<host>localhost</host>
<port>3306</port>
<user>horde_user</user>
<password>password</password>
<database>horde_db</database>
<schemaversion>6.2</schemaversion>
<realm>HORDE</realm>
<username_field>hordeuser</username_field>
<password_field>hordepass</password_field>
<encryption>
    <type>blowfish</type>
    <secret>7e88344fd5b14dad</secret>
    <mode>cfb</mode>
</encryption> 

Save and close the file by pressing Ctrl + X , press Y and then ENTER.

Step 7: Install and enable Apache modules

We need to enable a few Apache modules that are required by Horde. You can run the following command to enable them.

sudo a2enmod ssl rewrite headers

Step 8: Create an Apache Virtual Host for Horde

We will create an Apache virtual host for Horde, so it's accessible from a web browser.

Create a new configuration file and open it using the editor.

sudo nano /etc/apache2/sites-available/horde.example.com.conf

Add the following content to the file.

<VirtualHost *:80>
    ServerName horde.example.com
    Redirect permanent / https://horde.example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName horde.example.com
    DocumentRoot /var/www/horde.example.com/imp-6.2.40
    <Directory /var/www/horde.example.com>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R=301]
    SSLEngine on
    SSLCertificateFile      /etc/ssl/certs/horde.example.com.crt
    SSLCertificateKeyFile   /etc/ssl/private/horde.example.com.key
    SSLCertificateChainFile /etc/ssl/certs/horde.example.com.ca-bundle
</VirtualHost>

Create SSL certificates for your domain name and replace horde.example.com.crt, horde.example.com.key, and horde.example.com.ca-bundle with respective cert files in the above file. You can install Let's Encrypt or use any other SSL provider to obtain SSL certificates for your domain name.

Save and close the file by pressing Ctrl + X , press Y and then ENTER.

Enable the virtual host configuration by running the following command.

sudo a2ensite horde.example.com.conf

Step 9: Restart Apache

Lastly, restart the apache service to apply changes.

sudo systemctl restart apache2.service

Step 10: Access the Horde Webmail

Open a web browser and navigate to https://horde.example.com/imp-6.2.40/login.php. You will see the default Horde login screen.

Enter your email address and password to login and start managing your email, contacts and calendars with Horde.

Conclusion

In this tutorial, we have successfully installed and configured Horde webmail on Ubuntu Server. You can now access and manage your emails, calendars, and contacts with ease.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!