We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install iRedMail Mail Server on CentOS 7

Learn how to – How To Install iRedMail Mail Server on CentOS 7.

This guide will walk you through the steps to install iRedMail on CentOS 7. iRedMail is an easy to deploy, configure and manage Mail solution for Linux, FreeBSD and OpenBSD systems. With iRedMail, it becomes so easy to deploy an opensource, fully fledged, powerful mail server with features only available in commercial mail solutions.

Debian: Install and Setup iRedMail Mail Server on Debian Linux

Features of iRedMail Mail Server

  • Fully Open Source: All iRedMail components are built from open source applications. It has bee certified to run on Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, FreeBSD, OpenBSD.
  • Top Security: All mail services are accessed through secured connections – Use of TLS to access POP3, IMAP and SMTP services. Web portals are access via HTTPS. Emails are encrypted in transit using TLS if possible.
  • Access to Webmail: An intuitive web portal is available for accessing and managing mails, folders, sieve filters – (Roundcube webmail or/and SOGo groupware).
  • Unlimited Accounts: You have the powers to create as many mail accounts (domains, users, mailing lists, admins) as you want.
  • Web Admin Panel: As admin user, you get a web admin panel where you manage mail accounts.
  • Antispam & Antivirus: SpamAssassin, ClamAV, SPF, DKIM, greylisting, whitelisting, blacklisting. Quarantining detected spam into SQL database for further review.
  • Support for OpenLDAP, MySQL, MariaDB, and PostgreSQL backend store for mail accounts. Choose what you like.

Setup requirements

There are few System Requirements which has to be satisfied to get a successful deployment of iRedMail on CentOS 7. The basic requirements are:

  • Fresh Installation of CentOS 7
  • 2 GB of memory required. If you plan to use it in production environment with multiple domains and user accounts, the add more memory – 4 GB+
  • Make sure 3 UID/GID are not used by other user/group: 2000, 2001, 2002.
  • Mail Server domain name
  • A sudo user account – User account added to wheel group or root user access

The next sections will discuss the actual steps to be followed when installing and configuring iRedMail Mail Server on CentOS 7.

Step 1: Add EPEL repository & Update System

Start by adding the EPEL repository and updating your CentOS 7 system.

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

After a system upgrade, we recommend doing a reboot.

sudo shutdown -r now

Step 2: Set SELinux in Permissive mode

iRedMail development team doesn’t provide SELinux policies for the service to work when SELinux is enforcing. You need to disable SELinux or configure it to run in Permissive mode.

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

Confirm current SELinux status after making the change.

$ 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 Server hostname

Set server hostname to a subdomain name configured in your DNS server.

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

After updating your hostname, logout and login again to update your working environment.

$ logout

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

# Example
$ sudo vim /etc/hosts mail.ownyourlife.com.ng

To confirm DNS resolution, first install bind-utils package.

sudo yum -y install bind-utils

Then use host command for local resolution.

$ host mail.ownyourlife.com.ng
mail.ownyourlife.com.ng has address

For record in DNS server, use the dig command.

$ dig A mail.ownyourlife.com.ng

Step 4: Download the latest release of iRedMail

Visit the iRedMail Download page to get the latest stable release of iRedMail for your platform.

Use wget to download the latest release.

sudo yum -y install wget
wget https://github.com/iredmail/iRedMail/archive/1.4.2.tar.gz

Extract the downloaded archive file.

sudo yum -y install tar bzip2 dialog
tar xvf 1.4.2.tar.gz

Step 5: Install iRedMail on CentOS 7

An installer script is provided for automated installation of iRedMail Mail Server on CentOS 7. Change the working directory to the folder created.

cd iRedMail-*/

Start iRedMail installer.

chmod +x iRedMail.sh

# Run with sudo
CHECK_NEW_IREDMAIL=NO sudo bash iRedMail.sh

# Run as root user

The installer script will install dependencies required then ask you several simple questions required to setup iRedMail mail server on CentOS 7.

1 – Accept installation wizard

The first screen asks you whether to accept or decline installation of iRedMail on CentOS 7.

2 – Specify directory used to store mailboxes

Make sure you read the NOTES provided before changing default mailboxes store directory.

3 – Choose web server to use

Go with the default selection of nginx.

4 – Choose backend used to store mail account

Choose the one you’re familiar with for easier management and maintenance after installation. I’ll go with OpenLDAP.

5 – Specify LDAP Suffix

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

6 – Set MySQL root password

Provide the password for MySQL root user.

7 – Add your first mail domain name

Provide your Mail domain name – This cannot be the same as server name.

7 – Provide Password for Mail domain Administrator

Input the mail domain administrator password and tick the features to enable.

Review provided values and start installation.

***************************** WARNING ***********************************
*                                                                       *
* Below file contains sensitive infomation (username/password), please  *
* do remember to *MOVE* it to a safe place after installation.          *
*                                                                       *
*   *  
*                                                                       *
********************** 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:               ownyourlife.com.ng
* Mail domain admin:                    postmaster@ownyourlife.com.ng
* Additional components:                Roundcubemail netdata iRedAdmin Fail2ban

< Question > Continue? [y|N] y

Type y or Y and press Enter to start installation. The script will install and configure all the packaged required automatically.

Accept Firewall configurations.

* iRedMail-1.4.2 installation and configuration complete.

[ 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]
[ INFO ] Copy firewall sample rules.
< Question > Restart firewall now (with ssh ports: 22)? [y|N]
< Question > Would you like to use MySQL configuration file shipped within iRedMail now?
< Question > File: /etc/my.cnf. [Y|n]
[ INFO ] Copy MySQL sample file: /etc/my.cnf.
[ INFO ] Updating ClamAV database (freshclam), please wait ...
ClamAV update process started at Sat May 14 18:49:09 2022
DON'T PANIC! Read https://docs.clamav.net/manual/Installing.html
daily database available for download (remote version: 26541)
Testing database: '/var/lib/clamav/tmp.1cc9fc6c88/clamav-a2b3b27984954e9cf09ed5737fde5464.tmp-daily.cvd' ...
Database test passed.
daily.cvd updated (version: 26541, sigs: 1984416, f-level: 90, builder: raynman)
main database available for download (remote version: 62)
Testing database: '/var/lib/clamav/tmp.1cc9fc6c88/clamav-88cff870b13292c99f008b3f8803c209.tmp-main.cvd' ...
Database test passed.
main.cvd updated (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
bytecode database available for download (remote version: 333)
Testing database: '/var/lib/clamav/tmp.1cc9fc6c88/clamav-55e522118934cf943daf83b6acf3b031.tmp-bytecode.cvd' ...
Database test passed.
bytecode.cvd updated (version: 333, sigs: 92, f-level: 63, builder: awillia2)

Successful installation output:

* URLs of installed web applications:
* - Roundcube webmail: https://iredmail.ownyourlife.com.ng/mail/
* - netdata (monitor): https://iredmail.ownyourlife.com.ng/netdata/
* - Web admin panel (iRedAdmin): https://iredmail.ownyourlife.com.ng/iredadmin/
* You can login to above links with below credential:
* - Username: postmaster@ownyourlife.com.ng
* - Password: password
* Congratulations, mail server setup completed successfully. Please
* read below file for more information:
*   - /root/iRedMail-1.4.2/iRedMail.tips
* And it's sent to your mail account postmaster@ownyourlife.com.ng.
********************* WARNING **************************************
* Please reboot your system to enable all mail services.

Reboot your Server to enable mail services.

sudo reboot

Step 6: iRedMail Access Credentials

Your iRedMail Server details & Access credentials are store in the file “/root/iRedMail-1.x/config” if script was run as root user or “./iRedMail-1.x/config” if the script was executed as normal user.

The URLs of installed web applications are shown after a successful installation of iRedMail on CentOS 7.

Login to the portals using the credentials saved.

Here is the default look of iRedMail Admin dashboard on initial login.

Step 7: Secure iRedMail With Let’s Encrypt SSL Certificates

iRedMail generates self-signed certificates during installation, you have an option of getting a Commercial certificate or using Let’s Encrypt free SSL Certificates. Refer to our guide below.

Our next guide below covers addition of domains and users to iRedMail Mail server:

Related mail guides:


Your Cart is Empty

Back To Shop