iRedMail 0.7.0: Full-Featured Mail Server With OpenLDAP/Postfix/Dovecot/Amavisd/ClamAV/SpamAssassin/RoundCube/iRedAdmin On FreeBSD 7.x 8.x

Last edited 03/31/2011 

iRedMail is a shell script that lets you quickly deploy a full-featured mail solution in less than 2 minutes. Since version 0.6, it supports FreeBSD 7.2 and 8.0 (it supports both i386 and x86_64). Its object is to make a Linux mail server installation and configuration simple and easy to use. iRedMail supports both OpenLDAP and MySQL as backends for storing virtual domains and users. This tutorial shows how to use the OpenLDAP backend; it uses FreeBSD 8.2, but the steps for 7.x are the same.

iRedmail provides RoundCube as a webmail program, which supports the MySQL and OpenLDAP backends and can change the passwords and vacation settings.

The iRedMail project was published two years ago (2007-11-01).

All the packages come from ports except iRedAdmin.


1 Requirements

It is strongly recommended to install a minimal FreeBSD system (no additional packages are required), and then deploy mail service via iRedMail solution.

To install such a system you will need the following:


2 Preliminary Note

In this tutorial we use:
  • Hostname
  • IP address
  • LDAP suffix (root dn) dc=example,dc=com
  • The first virtual domain:


3 Setting hostname

No matter if your server is external or internal, it is strongly recommended that you set up a fully qualified domain name (FQDN) hostname.

In FreeBSD, hostname is set in /etc/rc.conf:


Map this hostname to in /etc/hosts: mail localhost localhost.localdomain

Verify the FQDN hostname:

  # hostname -f


4 Update ports tree via portsnap

# portsnap fetch
# portsnap extract
# portsnap fetch update


5 Install packages required by iRedMail

Bash shell:

# pkg_add -r bash-static
# rehash


# pkg_add -r wget
# rehash


6 Start to install iRedMail

Download the new version of iredmail:

# wget
# tar jxvf iRedMail-0.7.0.tar.bz2

Start the iRedMail installer:

# cd iRedMail-0.7.0
# bash

Welcome page:

Choose the directory that will be used to store users' mailboxes.

iRedMail supports both OpenLDAP and MySQL as backends to store virtual domains and users. OpenLDAP is recommended.

LDAP suffix, normally it's your domain name, such as: dc=example,dc=com:

Set password for LDAP server admin: cn=Manager,dc=example,dc=com

Set the MySQL root password:

Add your first virtual domain, e.g.:

Set password for the virtual domain admin: [email protected], you can log into iRedadmin and Awstats with this account.

Set password for the first normal user [email protected] for the first virtual domain:

Select optional components:

Select the default language for your webmail application:

The configuration is now finished, we can now start the installation:

During the download of the software, you might see an error like this:

=> rarbsd-3.9.0.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from
fetch: Moved Temporarily
=> Attempting to fetch from
fetch: File unavailable (e.g., file not found, no access)
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/ and try again.
*** Error code 1

Stop in /usr/ports/archivers/rar.
*** Error code 1

Stop in /usr/ports/security/amavisd-new.
< ERROR > Tarballs were not downloaded correctly, please fix it before we go further.

This happens because the rarbsd package is missing, so you need to install it:

# wget
# mv rarbsd-3.9.0.tar.gz /usr/ports/distfiles/

Then run the iRedMail installer again.

# bash

< INFO > Checking necessary command/package: dialog/dialog ...
< INFO > Check configuration file: /root/iRedMail-0.6.0-beta2/config... Found.
< Question > Use it for mail server setting? [y|N]y

Finish the installation:

< INFO > Installing php Net_LDAP2 ...
< Question > Would you like to start postfix now? [y|N]

* Congratulations, mail server setup complete. Please refer to tip
* file for more information:
* - /root/iRedMail-0.6.0-beta2/
* And it's sent to your mail account [email protected]
* Please reboot your system to enable mail services or start them
* manually without reboot:
* # for i in mysql-server slapd dovecot amavisd postfix policyd clamav-clamd clamav-freshclam apache22; do /usr/local/etc/rc.d/${i} restart; done

You have new mail.

Start services manually without reboot:

# bash
# for i in mysql-server slapd dovecot amavisd postfix policyd clamav-clamd clamav-freshclam apache22; do /usr/local/etc/rc.d/${i} restart; done

Share this page:

Suggested articles

0 Comment(s)

Add comment


By: eddiechen