Install iRedmail on a CentOS 6.8 server

We need to set a FQDN hostname before we set up the mail server. On CentOS Linux, hostname is set in two files: Hostname setting:

nano /etc/sysconfig/network

# Part of file: /etc/sysconfig/network

HOSTNAME=demo.iredmail.org

Hostname <=> IP address mapping: /etc/hosts. WARNING: Please list the FQDN hostname as the first item.

# Part of file: /etc/hosts

127.0.0.1 demo.iredmail.org demo localhost localhost.localdomain

Verify the FQDN hostname with command ‘hostname -f’. If you change the hostname, please reboot the server to make it work.

$ hostname -f
demo.iredmail.org

Enable yum repositories for installing new packages
Please enable all default yum repositories in /etc/yum.repos.d/CentOS-Base.repo, and disable all third-party repositories. Repositories are enabled if you set “enabled=1” in the repo file.

Download The Latest Release Of iRedMail
Visit Download page to get the latest release of iRedMail. At least iRedMail-0.8.0-beta4 is required.

http://www.iredmail.org/download.html

Upload iRedMail to your mail server via ftp or scp or whatever method you can use, login to the server to install iRedMail. We assume you uploaded it to directory /root/iRedMail-x.y.z.tar.bz2 (replace x.y.z by the actual version number).

Uncompress iRedMail tarball:

# cd /root/
# tar xjf iRedMail-x.y.z.tar.bz2

Start iRedMail Installer
It’s now ready to start iRedMail installer, it will ask you some simple questions, that are all steps to set up a full-featured mail server.

# cd /root/iRedMail-x.y.z/
# bash iRedMail.sh

Screenshots Of iRedMail Installation
1) Welcome and thanks for your use:

2) Specify location to store all mailboxes. Default is /var/vmail/.

3) Choose backend used to store mail accounts. We will choose PostgreSQL for example in this tutorial, please choose the one which you’re familiar with. You can manage mail accounts with iRedAdmin, our web-based iRedMail admin panel.

4) Set password of PostgreSQL admin user. PostgreSQL is used to store mail accounts and application data. e.g. Roundcube webmail, Amavisd-new.

5) Add your first mail domain name:

6) Set password of admin account of your first mail domain. NOTE:

This account is used only for system administration, not a mail user. That means you CANNOT login to webmail with this account. You can login to iRedAdmin (web-based iRedMail admin panel) with this account for mail accont management, login name is full email address. Admin username is hard-coded, you can create new admins with iRedAdmin after installation has completed.

7) Set password of first mail user of your first mail domain. NOTE:

This account is a normal mail user, that means you can login to webmail with this account, login name is full email address. Username is hard-coded, you can create new mail users with iRedAdmin after installation has completed.

8) Choose optional components:

After these questions, iRedMail installer will ask you to confirm this installation. It will install and configure required packages automatically. Type y or Y and press Enter to confirm, type n or N and press Enter to cancel this installation.

...
Configuration completed.
*************************************************************************
***************************** WARNING ***********************************
*************************************************************************
* *
* Please do remember to *MOVE* configuration file after installation *
* completed successfully. *
* *
* * /root/iRedMail-x.y.z/config
* *
*************************************************************************
< Question > Continue? [y|N]

Setup DNS record for SPF

How to Setup DNS record for SPF

Please refer http://www.openspf.org/ to setup SPF record.

This is a simply example: 

iredmail.org. 3600 IN TXT "v=spf1 mx mx:mail.iredmail.org -all" or: iredmail.org. 3600 IN TXT "v=spf1 ip4:202.96.134.133 -all"

Another tip from maxie_ro: http://www.iredmail.org/forum/post5456.html#p5456

Setup DNS record for DKIM

After installation, please reboot your system, then use amavisd to help you setup DNS record.

Run command in terminal to show your DKIM keys:

amavisd showkeys
dkim._domainkey.iredmail.org. 3600 TXT ( "v=DKIM1; p=" "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYArsr2BKbdhv9efugByf7LhaK" "txFUt0ec5+1dWmcDv0WH0qZLFK711sibNN5LutvnaiuH+w3Kr8Ylbw8gq2j0UBok" "FcMycUvOBd7nsYn/TUrOua3Nns+qKSJBy88IWSh2zHaGbjRYujyWSTjlPELJ0H+5" "EV711qseo/omquskkwIDAQAB")

Note: On some Linux/BSD distribution, you should use command ‘amavisd-new’ instead of ‘amavisd’.

if it complains “/etc/amavisd.conf not found”, you should tell amavisd the correct path of its config file. For example: “`

amavisd -c /etc/amavisd/amavisd.conf showkeys

“`

Note: Bind can handle this kind of multi-line format, so you can paste it in your domain zone file directly.
Copy output of above command into one line, like below. It will be the value of DNS record. v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYArsr2BKbdhv9efugByf7LhaKtxFUt0ec5+1dWmcDv0WH0qZLFK711sibNN5LutvnaiuH+w3Kr8Ylbw8gq2j0UBokFcMycUvOBd7nsYn/TUrOua3Nns+qKSJBy88IWSh2zHaGbjRYujyWSTjlPELJ0H+5EV711qseo/omquskkwIDAQAB

Add a ‘TXT’ type DNS record, set value to the line you copied above.
After you added this in DNS, type below command to verify it: “`

amavisd testkeys
TESTING: dkim._domainkey.iredmail.org => pass ```

If it shows ‘pass’, it works.

Note: If you use DNS service provided by ISP, new DNS record might take some hours to be available.

References
http://www.dkim.org/

Access Webmail And Other Web Applications

After installation has successfully completed, you can access web-based programs if you choose to install them. Replace ‘your_server’ below by your actual server name or IP address.

  • Webmail: http://your_server/mail/ (or /webmail, /roundcube. HTTPS is available also.)
  • Admin panel: httpS://your_server/iredadmin/
  • phpMyAdmin: httpS://your_server/phpmyadmin/
  • Awstats: httpS://your_server/awstats/awstats.pl?config=web (or ?config=smtp)

Src:
https://www.howtoforge.com/build-a-full-featured-mail-server-with-postfix-dovecot-postgresql-on-centos-6
https://code.google.com/archive/p/iredmail/wikis/DNS_SPF.wiki
https://code.google.com/archive/p/iredmail/wikis/DNS_DKIM.wiki
https://docs.iredmail.org/setup.dns.html#how-to-setup-the-dkim-record

Share

Leave a Reply