0% found this document useful (0 votes)
10 views26 pages

Iredmail: Mail Server With Ldap, Postfix, Roundcube/Squirrelmail, Dovecot, Clamav, Spamassassin, Amavisd, Dkim, SPF On Debian (Lenny) 5.0.1

iRedMail is a shell script designed to quickly deploy a full-featured mail server on Debian 5.0.1, supporting both OpenLDAP and MySQL for backend storage. The tutorial covers installation steps, configuration of components like Postfix, Dovecot, and webmail options (RoundCube and SquirrelMail), and setting up necessary packages and user accounts. After installation, users can access webmail and other web-based programs through specified URLs.

Uploaded by

544x25mfps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views26 pages

Iredmail: Mail Server With Ldap, Postfix, Roundcube/Squirrelmail, Dovecot, Clamav, Spamassassin, Amavisd, Dkim, SPF On Debian (Lenny) 5.0.1

iRedMail is a shell script designed to quickly deploy a full-featured mail server on Debian 5.0.1, supporting both OpenLDAP and MySQL for backend storage. The tutorial covers installation steps, configuration of components like Postfix, Dovecot, and webmail options (RoundCube and SquirrelMail), and setting up necessary packages and user accounts. After installation, users can access webmail and other web-based programs through specified URLs.

Uploaded by

544x25mfps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.

1)

By eddiechen
Published: 2009-06-03 18:12

iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV,


SpamAssassin, Amavisd, DKIM, SPF On Debian (Lenny) 5.0.1
iRedMail is a shell script that lets you quickly deploy a full-featured mail solution in less than 2 minutes. Since iRedMail 0.5, it supports Debian 5.0.1 (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 OpenLDAP as the backend.

Now iRedmail provides two webmail program, RoundCube and SquirrelMail, and both support the MySQL and OpenLDAP backends and can change the
password.

- Main components used in this solution: http://code.google.com/p/iredmail/wiki/Main_Components


- Discussion forum: http://www.iredmail.org/forum/
- Project home page: http://code.google.com/p/iredmail/

1 Requirements
It is strongly recommended that you use the 'netinst' version to install a minimal Debian system, and then deploy mail service via iRedMail solution. e.g.:

To install such a system you will need the following:

- debian-501-amd64-netinst.iso or debian-501-i386-netinst.iso , download Debian CD/DVD images via HTTP/FTP


- Internet connection.

2 Preliminary Note
In this tutorial we use:

- Hostname mail.example.com

Copyright © 2009 All Rights Reserved. HowtoForge Page 1 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

- IP address 192.168.1.10
- LDAP suffix (root dn) dc=example,dc=com
- The first virtual domain: example.com

3 Install The Latest Lenny Updates


Update /etc/apt/sources.list, use default stable version. e.g.

# vi /etc/apt/sources.list

deb http://mirrors.163.com/debian lenny main contrib non-free


deb http://security.debian.org/ lenny/updates main contrib non-free

# apt-get update

3 Setting hostname
In Debian (Lenny), hostname is set in these two files:

* /etc/hostname: hostname setting


* /etc/hosts: hostname <=> IP address mapping

Map this hostname to '127.0.0.1' (Warning: List the FQDN hostname as first item.)

Copyright © 2009 All Rights Reserved. HowtoForge Page 2 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

# vi /etc/hosts

#127.0.0.1 localhost
#127.0.1.1 mail.example.com mail
127.0.0.1 mail.example.com mail localhost localhost.localdomain

# vi /etc/hostname

mail

Verify the FQDN hostname:

# hostname --fqdn

mail.example.com

4 Install necessary packages

Copyright © 2009 All Rights Reserved. HowtoForge Page 3 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

We need to use wget for the download and dialog for the user interface of installation wizard.

# apt-get install wget dialog

5 Install acl packages


We need to install acl for advanced file system acl control:

# apt-get install acl

Add mount option 'acl' in /etc/fstab which contains the /etc/ directory if it isn't there yet. Copy it as a new line, and comment out the old one, add acl
like below.

# vi /etc/fstab

#/dev/hda1 / ext3 errors=remount-ro 0 1


/dev/hda1 / ext3 acl,errors=remount-ro 0 1

Remount the mount point which contains the /etc/ directory, e.g. /:

# mount -o remount,rw,acl /

Copyright © 2009 All Rights Reserved. HowtoForge Page 4 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

6 Start iRedMail Installation


Switch to root user, we must execute further commands as root user without sudo.

$ sudo su -

Download the new version of iRedMail:

# wget http://iredmail.googlecode.com/files/iRedMail-0.5.0-rc1.tar.bz2

# tar jxvf iRedMail-0.5.0-rc1.tar.bz2

Get the necessary packages. It will create a local apt repository in the current directory.

# cd iRedMail-0.5.0-rc1/pkgs/

# bash get_all.sh

Copyright © 2009 All Rights Reserved. HowtoForge Page 5 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Make sure dovecot-common-1.1.x is listed in the below command:

# apt-get update

# apt-cache show dovecot-common

Start the iRedMail installer:

Copyright © 2009 All Rights Reserved. HowtoForge Page 6 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

# cd ..

# bash iRedMail.sh

Welcome page:

Copyright © 2009 All Rights Reserved. HowtoForge Page 7 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

All emails should be stored in this directory:

Copyright © 2009 All Rights Reserved. HowtoForge Page 8 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

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

Copyright © 2009 All Rights Reserved. HowtoForge Page 9 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

LDAP suffix, normally it's your domain name, such as: dc=example,dc=com
iRedMail will put all virtual domains/users in 'o=domains,dc=example,dc=com', it's called 'LDAP base dn': o=domains,dc=example,dc=com.

Copyright © 2009 All Rights Reserved. HowtoForge Page 10 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set a password for the LDAP server admin. The admin account is defined in /etc/ldap/slapd.conf, normaily it's: cn=Manager,dc=example,dc=com.

Copyright © 2009 All Rights Reserved. HowtoForge Page 11 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set a password for the LDAP virtual domain admin's password.


Note: cn=vmailadmin,dc=example,dc=com is used to manage all virtual domains/users.

Copyright © 2009 All Rights Reserved. HowtoForge Page 12 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set a password for the MySQL root user:

Copyright © 2009 All Rights Reserved. HowtoForge Page 13 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Add your first virtual domain, e.g.:

Copyright © 2009 All Rights Reserved. HowtoForge Page 14 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Virtual domain administrator account for the first virtual domain. Default is 'postmaster':

Copyright © 2009 All Rights Reserved. HowtoForge Page 15 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set a password for the virtual domain administrator:

Copyright © 2009 All Rights Reserved. HowtoForge Page 16 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Add the first normal user for our virtual domain. e.g.: www. The full email address will be [email protected].

Copyright © 2009 All Rights Reserved. HowtoForge Page 17 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set a password for above normal user:

Copyright © 2009 All Rights Reserved. HowtoForge Page 18 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Enable the SPF verify and DKIM verify/sign feature:

Copyright © 2009 All Rights Reserved. HowtoForge Page 19 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Select optional components, you can choose RoundCube or SquirrelMail as webmail programs.
An Awstat user account has been integrated in LDAP, so you need to use the username: [email protected]. For details, read the file
iRedMail-x.y.z/iRedMail.tips.

Copyright © 2009 All Rights Reserved. HowtoForge Page 20 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Select webmail's default language:

Copyright © 2009 All Rights Reserved. HowtoForge Page 21 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Set an alias mail address for the root user:

Copyright © 2009 All Rights Reserved. HowtoForge Page 22 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

Finish the configuration and start to install the software:

Copyright © 2009 All Rights Reserved. HowtoForge Page 23 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

After the installation has finished, reboot the machine:

Copyright © 2009 All Rights Reserved. HowtoForge Page 24 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

7 Important Things You Should Know After Installation


- Read file iRedMail-x.y.z/iRedMail.tips first, it contains:

- User password and related sensitive information.


- Location of mail serve related software configuration files and other important information.
- Setup DNS record for SPF
- Setup DNS record for DKIM
- iRedMail Admin Guide

8 Access webmail and other web-based programs

Copyright © 2009 All Rights Reserved. HowtoForge Page 25 of 26


iRedMail: Mail Server With LDAP, Postfix, RoundCube/SquirrelMail, Dovecot, ClamAV, SpamAssassin, Amavisd (Debian 5.0.1) http://www.howtoforge.com/

After 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
RoundCubeMail-0.2.1 http://your_server/mail/ (or /webmail, /roundcube) YES YES Recommand webmail
SquirrelMail-1.4.19 http://your_server/squirrelmail/ (or /squirrel) YES YES webmail
PostfixAdmin-2.2.1.1 https://your_server/postfixadmin/ No YES Only Mysql Backend
phpMyAdmin-2.11.9.5 https://your_server/phpmyadmin/ (or /mysql) NO YES
phpLDAPadmin-1.1.0.7 https://your_server/ldap/ (or /phpldapadmin) NO YES Only LDAP Backend
Awstats-6.9 https://your_server/awstats/awstats.pl (or /awstats.pl?config=mail) NO YES

Note: Replace your_server with your server hostname or IP address.

Copyright © 2009 All Rights Reserved. HowtoForge Page 26 of 26

You might also like