Setup iRedMail on Debian Wheezy

Published on: Tue, Nov 18, 2014 at 1:59 pm EST
Debian Linux Guides
Archived content

The information in this article is outdated and the steps may not apply to newer versions of the Operating System or Software.

This tutorial will show you how to install the groupware iRedMail on a fresh installation of Debian Wheezy.

You should use a server with at least one gigabyte of memory, preferably even two. While the software doesn't use many resources when idling, it peaks very fast when under load. For example, during virus scans.

Important: Please do not try to install iRedMail on a system that's already in production. It's designed to be installed on a fresh installation and will override other MTAs when it finds them. Please be cautious and always have backups at hand.

For the course of this tutorial, we will assume that you are working as the administrative user. If you want to use sudo instead, then you will have to append it where necessary.

First, make sure that a fully qualified domain name is set by opening /etc/hostname with your favorite text editor and replacing the value there with a FQDN:

mail.example.com

Next, make sure that FQDN is the first value listed in /etc/hosts:

127.0.0.1   mail.example.com mail localhost localhost.localdomain

Verify that everything worked by issuing hostname -f. The output should be:

mail.example.com

The only dependency of iRedMail is bzip2, install it with:

apt-get install bz2

Download and unpack the latest version from the official homepage:

wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.7.tar.bz2
tar -xf iRedMail-0.8.7.tar.bz2

Change the permissions of the script, and run the installer:

cd iRedMail-0.8.7/
chmod 700 iRedMail.sh
./iRedMail.sh

The installation script will update your package list, then ask you some questions:

  • Location for the mailboxes, /var/vmail is the default and perfectly fine.
  • Backend used to store the accounts, there is no default. For a small number of users, MySQL is just fitting - if you want to integrate into, for example, an ActiveDirectory user base then you should choose OpenLDAP.
  • A password for the administrative MySQL user - be careful not to use special characters as this will cause problems.
  • First virtual domain name - example.com for this tutorial.
  • A password for the administrative mailuser - you should also avoid special characters.
  • Optional components - you should at least choose iRedAdmin, phpMyAdmin and Roundcubemail for this question.

The installer will now prompt you about a file with sensitive information in it, /root/iRedMail-0.8.7/config, make sure to properly set the file permissions when the installation is finished:

chmod 600 /root/iRedMail-0.8.7/config

At this point, the installation script installs a lot of packages. After it has finished, you will be asked about firewall rules:

< Question > Would you like to use firewall rules provided by iRedMail now?
< Question > File: /etc/default/iptables, with SSHD port: 22. [Y|n]

These questions depend on your wants. For a sane ruleset to start with, you should go for Y here. Next, you'll be prompted with all the necessary information to use iRedMail - after a reboot:

reboot

(Don't worry, the prompted information can be found in /root/iRedMail-0.8.7/iRedMail.tip after the reboot.)

The webmail interface can now be accessed with your web browser at:

https://mail.example.com/mail

However, since iRedMail uses a certificate that's not issued by a legitimate certificate authority (CA), you will most likely get a security warning from your browser. If you would like to remove the security warning, then you will need to obtain a certificate from a trusted CA. Installing a different certificate requires both the certificate and the private key. Once uploaded to your server, these files can be copied to the proper location with the following commands:

cp /path/to/your/cert /etc/ssl/certs/iRedMail_CA.pem
cp /path/to/your/key /etc/ssl/private/iRedMail.key

Then, restart everything that uses the cert/key:

service postfix restart
service dovecot restart
service apache2 restart

And now you have a all-in-one mail solution. Happy mailing!

Other Versions

Debian

FreeBSD

Want to contribute ?

You could earn up to $300 by adding new articles