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: 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

wget:

# 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:

iredmail_01

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

iredmail_02

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

iredmail_03

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

iredmail_04

Set the MySQL root password:

iredmail_05

Add your first virtual domain, e.g.:

iredmail_07

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

iredmail_08

Set password for the first normal user www@example.com for the first virtual domain:

iredmail_09

Select optional components:

iredmail_10

Select the default language for your webmail application:

iredmail_12

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

iredmail_14

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.

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

# 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 www@example.com.
*
* 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

7 Test the mail system

7.1 webmail RoundCube

Log into RoundCube, use the first user www@example.com:

iredmail_16

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

iredmail_17

7.2 iRedAdmin

Log into iRedAdmin: postmaster@example.com

iredmail_18

Dashboard:

iredmail_19

Mail Domains:

iredmail_24

Mail User:

iredmail_25

Mail Admin:

iredmail_26

Create new mail user:

iredmail_27

Select language:

iredmail_28

7.3 phpLDAPAdmin

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

iredmail_28

Manage the mail account:

iredmail_21

7.4 Awstats

Log into Awstats: postmaster@example.com

iredmail_22

Check the statistics:

iredmail_23

8 Important Things You Should Know After Installation

  • Read the file iRedMail-x.y.z/iRedMail.tips first, iRedmail.tips 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/awstats.pl NO YES

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

 

 

Comments

comments