Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

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

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.

  • Main components used in this solution:
  • Discussion forum and bug report:
  • iRedmail FAQ:
  • Project home page:


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:

  • the FreeBSD 8.2 server CD, available here:
  • Internet connection.


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 the MySQL root password:


Add your first virtual domain, e.g.:


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


Set password for the first normal user 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
* 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

7 Test the mail system

7.1 webmail RoundCube

Log into RoundCube, use the first user


The account has received two emails, read them carefully.
Note: because is a root alias, it receives system emails.


7.2 iRedAdmin

Log into iRedAdmin:




Mail Domains:


Mail User:


Mail Admin:


Create new mail user:


Select language:


7.3 phpLDAPAdmin

Log into phpLDAPAdmin: cn=manager,dc=example,dc=com


Manage the mail account:


7.4 Awstats

Log into Awstats:


Check the statistics:


8 Important Things You Should Know After Installation

  • Read the file iRedMail-x.y.z/ first, example, it contains:
    • User password and related sensitive information.
    • Location of mail server related software configuration files and other important information.
  • Setup DNS record for SPF
  • Setup DNS record for DKIM
  • Enable signing disclaimer on outgoing mails


9 Access webmail and other web-based programs

After the installation is complete, you can access web-based programs if you’ve chosen to install them:

Component URL Access via HTTP Access via HTTPS Comment
Roundcube 0.31 http://your_server/mail/ (or /webmail, /roundcube) YES YES Recommand webmail
iRedAdmin https://your_server/iredadmin NO YES Only Ldap Backend
phpMyAdmin https://your_server/phpmyadmin/ (or /mysql) NO YES
phpLDAPAdmin https://your_server/ldap/ (or /phpldapadmin) NO YES Only LDAP Backend
Awstats https://your_server/awstats/ NO YES

Note: Replace your_server with your server hostname or IP address.
iRedAdmin, phpMyAdmin, phpLDAPAdmin and Awstats use https by default.