How to install iRedMail mail server on CentOS 7

This guide will guide you through the steps to install iRedMail on CentOS 7. iRedMail is a step that is easy to deploy, configure and manage Mail solutions for Linux, FreeBSD and OpenBSD systems. With iRedMail, it is so easy to deploy a fully featured open source, powerful mail server with features available only in commercial mail solutions.

Features of iRedMail mail server

  • Completely open source: All iRedMail components are built from open source applications. It is bee certified and runs on Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, FreeBSD, OpenBSD.
  • Highest security: Access all mail services through a secure connection – access POP3, IMAP and SMTP services using TLS. The web portal is accessible via HTTPS. Emails are encrypted using TLS whenever possible.
  • Access webmail: Intuitive web portal can be used to access and manage mail, folders, filters (Roundcube Webmail or / and SOGo components).
  • Unlimited account: You can create as many mail accounts (domains, users, mailing lists, administrators) as you need.
  • Web Management Panel: As an admin user, you will get a web management panel where you can manage your mail account.
  • Anti-spam and anti-virus: SpamAssassin, ClamAV, SPF, DKIM, greylist, whitelist, blacklist. Isolate detected spam into a SQL database for further inspection.
  • Supports OpenLDAP, MySQL, MariaDB and PostgreSQL backend storage for mail accounts. Choose what you like.

Setting requirements

Successful deployment of iRedMail on CentOS 7 requires few system requirements. The basic requirements are:

  • Fresh install CentOS 7
  • 2 GB Required memory. If you plan to use it in a production environment with multiple domains and user accounts, add more memory – 4 GB or more
  • Make sure other users / groups are not using 3 UID / GID: 2000, 2001, 2002.
  • Mail server domain name
  • sudo user account – the user account to add to Wheel Group or root user access

The next section will discuss the practical steps to follow when installing and configuring iRedMail Mail Server on CentOS 7.

Step 1: Add EPEL repository and update system

First add EPEL repository and update CentOS 7 system.

sudo yum -y install epel-release
sudo yum -y update

After the system upgrade, it is recommended to restart.

sudo shutdown -r now

Step 2: Set SELinux to Licensing

When SELinux was enforced, the iRedMail development team did not provide a SELinux policy to make the service work properly. You need to disable SELinux or configure it to run in licensed mode.

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

After making changes, confirm the current SELinux status.

$ sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

Step 3: Set the server host name

Set the server host name to the subdomain name configured in the DNS server.

export HOSTNAME="mail.computingforgeeks.com"
sudo hostnamectl set-hostname $HOSTNAME --static
sudo hostnamectl set-hostname $HOSTNAME --transient

After updating the host name, log out and log in again to update your work environment.

$ logout

Now add IP address and DNS name mapping to / etc / hosts file.

# Example
$ sudo vim /etc/hosts
95.216.98.16 mail.computingforgeeks.com

To confirm DNS resolution, first install Binding tool package.

sudo yum -y install bind-utils

Then use the host command for local resolution.

$ host mail.computingforgeeks.com
mail.computingforgeeks.com has address 95.216.98.16

To record in the DNS server, use the dig command.

$ dig A mail.computingforgeeks.com

Step 4: Download the latest version of iRedMail

Visit the iRedMail download page to get the latest stable version of iRedMail for your platform.

As of this writing, the latest stable version is 0.9.9, Version 1.0 Still in Beta.

sudo yum -y install wget
wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.9.tar.bz2

Extract the downloaded archive file.

sudo yum -y install bzip2
tar xjvf iRedMail-0.9.9.tar.bz2

Step 5: Install iRedMail on CentOS 7

An installer script is provided for automatically installing iRedMail Mail Server on CentOS 7. Change the working directory to the folder you created.

cd iRedMail-*/

Launch the iRedMail installer.

chmod +x iRedMail.sh
sudo ./iRedMail.sh

The installer script will install the required dependencies and then ask you a few simple questions to set up the iRedMail mail server on CentOS 7.

1-Accept the installation wizard

The first screen asks if you accept or decline to install iRedMail on CentOS 7.

How to install iRedMail mail server on CentOS 72-Specify the directory to store the mailbox

Before changing the default mailbox store directory, make sure you have read the notes provided.

How to install iRedMail mail server on CentOS 73-Select the web server to use

Use nginx’s default selection.

How to install iRedMail mail server on CentOS 74-Select the backend for storing mail accounts

Choose the equipment you are familiar with for easier management and maintenance after installation. I will use OpenLDAP.

How to install iRedMail mail server on CentOS 75-Specify the LDAP suffix

If you choose OpenLDAP as the default backend for storing mail accounts, provide the LDAP suffix. These are just part of your domain name.

How to install iRedMail mail server on CentOS 76-Set MySQL root password

Provide the password of the MySQL root user.

How to install iRedMail mail server on CentOS 77 – Add your first email domain

Provide your mail domain name-this name cannot be the same as the server name.

How to install iRedMail mail server on CentOS 77-Provide a password for the mail domain administrator

Enter the mail domain administrator password and check the features you want to enable.

How to install iRedMail mail server on CentOS 7

Review the values ​​provided and start the installation.

***************************** WARNING ***********************************
*************************************************************************
*                                                                       *
* Below file contains sensitive infomation (username/password), please  *
* do remember to *MOVE* it to a safe place after installation.          *
*                                                                       *
*   * /home/centos/iRedMail-0.9.9/config
*                                                                       *
*************************************************************************
********************** Review your settings *****************************
*************************************************************************

* Storage base directory:               /var/vmail
* Mailboxes:                            
* Daily backup of SQL/LDAP databases:   
* Store mail accounts in:               OpenLDAP
* Web server:                           Nginx
* First mail domain name:               computingforgeeks.com
* Mail domain admin:                    [email protected]
* Additional components:                Roundcubemail SOGo netdata iRedAdmin Fail2ban

< Question > Continue? [y|N] y

Types of y Either Y then press Enter start installation. The script will automatically install and configure all required package files.

Accept the firewall configuration.

[ INFO ] Disable SELinux in /etc/selinux/config.
< Question > Would you like to use firewall rules provided by iRedMail?
< Question > File: /etc/firewalld/zones/iredmail.xml, with SSHD ports: 22. [Y|n]y
[ INFO ] Copy firewall sample rules: /etc/firewalld/zones/iredmail.xml.
< Question > Restart firewall now (with ssh ports: 22)? [y|N]y
[ INFO ] Restarting firewall ...
< Question > Would you like to use MySQL configuration file shipped within iRedMail now?
< Question > File: /etc/my.cnf. [Y|n]y
[ INFO ] Copy MySQL sample file: /etc/my.cnf.
[ INFO ] Enable SSL support for MySQL server.
[ INFO ] Updating ClamAV database (freshclam), please wait ...
ClamAV update process started at Thu Oct 24 20:38:51 2019
Downloading main.cvd [100%]
main.cvd updated (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Downloading daily.cvd [100%]
daily.cvd updated (version: 25612, sigs: 1954294, f-level: 63, builder: raynman)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
Database updated (6520637 signatures) from database.clamav.net (IP: 104.16.219.84)

Restart the server to enable the mail service.

sudo reboot

Step 6: iRedMail access credentials

Your iRedMail server details and access credentials are stored in a file “/root/iRedMail-0.9.9/config“” (If the script runs as root) or “/home/username/iRedMail-0.9.9/config“(If the script is executed as a normal user).

After successfully installing iRedMail on CentOS 7, the URL of the installed web application will be displayed.

  • Roundcube webmail: Https: // your server / mail /
  • SOGo components: Https: // your server / SOGo
  • Web Management Panel (iRedAdmin): HttpS: // your_server / iredadmin /
  • Awstats: HttpS: //your_server/awstats/awstats.pl? config = web (or ?config=smtp For SMTP traffic logs)

My output looks like this.

********************************************************************
* URLs of installed web applications:
*
* - Roundcube webmail: https://mail.computingforgeeks.com/mail/
* - SOGo groupware: https://mail.computingforgeeks.com/SOGo/
* - netdata (monitor): https://mail.computingforgeeks.com/netdata/
*
* - Web admin panel (iRedAdmin): https://mail.computingforgeeks.com/iredadmin/
*
* You can login to above links with below credential:
*
* - Username: [email protected]
* - Password: fi5Moer5ush5e
*
*
********************************************************************
* Congratulations, mail server setup completed successfully. Please
* read below file for more information:
*
*   - /home/centos/iRedMail-0.9.9/iRedMail.tips
*
* And it's sent to your mail account [email protected]
*
********************* WARNING **************************************
*
* Please reboot your system to enable all mail services.
*
********************************************************************

Log in to the portal using the saved credentials.

How to install iRedMail mail server on CentOS 7

This is the default appearance of the iRedMail admin console at initial login.

How to install iRedMail mail server on CentOS 7

Step 7: Protect iRedMail with encrypted SSL certificate

iRedMail generates a self-signed certificate during the installation process. You can choose to obtain a commercial certificate or use “Let’s Encrypt Free SSL Certificate”. See the guide below.

Secure iRedMail server with encrypted SSL certificate

Our next guide will cover adding domains and users to the iRedMail Mail server. keep in touch.

Related email guidelines:

Install Zimbra on Ubuntu 18.04

Install and configure postal mail server on Ubuntu 18.04 LTS

Sidebar