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.
- Main components used in this solution: http://code.google.com/p/iredmail/wiki/Main_Components
- Discussion forum and bug report: http://www.iredmail.org/forum/
- iRedmail FAQ: http://www.iredmail.org/faq.html
- Project home page: http://code.google.com/p/iredmail/
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: http://www.freebsd.org/where.html
- Internet connection.
2 Preliminary Note
In this tutorial we use:- Hostname mail.example.com
- IP address 192.168.1.10
- LDAP suffix (root dn) dc=example,dc=com
- The first virtual domain: example.com
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:
hostname="mail.example.com"
Map this hostname to 127.0.0.1 in /etc/hosts:
127.0.0.1 mail.example.com mail localhost localhost.localdomain
Verify the FQDN hostname:
# hostname -f
mail.example.com
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 http://iredmail.googlecode.com/files/iRedMail-0.7.0.tar.bz2
# tar jxvf iRedMail-0.7.0.tar.bz2
Start the iRedMail installer:
# cd iRedMail-0.7.0
# bash iRedMail.sh
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 http://www.rarlab.com/rar/.
fetch: http://www.rarlab.com/rar/rarbsd-3.9.0.tar.gz: Moved Temporarily
=> Attempting to fetch from ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/.
fetch: ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/rarbsd-3.9.0.tar.gz: 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.
# wget http://ftp2.br.freebsd.org/distfiles/rarbsd-3.9.0.tar.gz
# mv rarbsd-3.9.0.tar.gz /usr/ports/distfiles/
Then run the iRedMail installer again.
# bash iRedMail.sh
< 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/iRedMail.tips
*
* 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.
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