This tutorial will show you how to install the groupware iRedMail on a fresh installation of FreeBSD 10.
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/rc.conf
with your favorite text editor and replacing the value there with a FQDN:
hostname="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 bash-static
(and wget
to fetch it) which can be found in the official pkg-repositories:
pkg
pkg update -f
pkg install bash-static
Since the installation script builds everything from FreeBSD’s ports tree, you need to fetch it:
portsnap fetch extract
Due to some complications with the Apache versioning from FreeBSD 10 upwards, you need to add the following to /etc/make.conf
to ensure that the installation script works:
DEFAULT_VERSIONS=apache=2.2
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 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 chooseOpenLDAP
. - 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
The installation script installs a lot of packages, and it may take some time to complete since everything is building from source.
Now 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!