Setting Up a Full-Featured Mail Server with iRedMail on CentOS

iRedMail is a free, open source, and comprehensive mail server solution for Linux. It enables you to host your own mail server with a user-friendly web interface that supports an unlimited number of mailboxes and domains.

iRedMail defaults to secure connection protocols including POP3/IMAP/SMTP over TLS and webmail via HTTPS. It utilizes Postfix as the Mail Transfer Agent (MTA), Dovecot as the Mail Delivery Agent (MDA), SpamAssassin for spam filtering, and both Amavis and ClamAV for virus scanning.

This tutorial will guide you through installing a fully functional mail server using iRedMail on CentOS 8.

Prerequisites

  • A server running CentOS 8.
  • A valid domain pointed to your server.
  • A root password configured on your server.

Getting Started

It is recommended to disable SELinux on your system before beginning. Edit the file /etc/sysconfig/selinux:

nano /etc/sysconfig/selinux

Change the desired line to:

SELINUX=disabled

Save and close the file. Next, you will need to set a fully qualified domain name for iRedMail. Do this by editing the /etc/hosts file:

nano /etc/hosts

Include the line below, customizing it for your server:

your-server-ip ired.linuxbuz.com ired

Save and close the file. Then install the EPEL repository and enable the PowerTools repository with the following commands:

dnf install epel-release -y
dnf config-manager --set-enabled PowerTools

Next, update the system packages:

dnf update -y

Reboot your system to apply these updates.

Download iRedMail Installation Script

Download the latest version of the iRedMail installation script from its official page:

wget https://github.com/iredmail/iRedMail/releases/download/1.2.1/iRedMail-1.2.1.tar.gz

When the download finishes, extract the file with:

tar -xvzf iRedMail-1.2.1.tar.gz

Change into the directory and set execution permission:

cd iRedMail-1.2.1
chmod +x iRedMail.sh

Install iRedMail

Run the installation script:

./iRedMail.sh

This will install all necessary dependencies. The setup wizard will begin shortly thereafter:

iRedMail Setup Wizard

Type yes and press Enter to proceed. You’ll be prompted to specify a directory for storing user mailboxes:

Mailbox Directory

Enter your desired directory and press Enter. Choose a web server next:

Web Server Choice

Select Nginx and press Enter. Choose the database backend to store mail accounts:

Database Backend

Select MariaDB and press Enter. Set a password for the MySQL root user:

MySQL Root Password

Enter a secure password and press Enter. Next, specify your mail domain:

Mail Domain

Enter your domain name and press Enter. Set the password for the mail domain administrator:

Domain Admin Password

Enter a secure password and press Enter. Choose any additional applications to install:

Additional Applications

Select your desired options and press Enter. Review your settings:

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

* Storage base directory:               /var/vmail
* Mailboxes:
* Daily backup of SQL/LDAP databases:
* Store mail accounts in:               MariaDB
* Web server:                           Nginx
* First mail domain name:               linuxbuz.com
* Mail domain admin:                    postmaster@linuxbuz.com
* Additional components:                RoundcubeMail Netdata iRedAdmin Fail2ban

< Question > Continue? [y|N]y

Type y and press Enter to start the installation. Upon completion, you’ll receive this confirmation:

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

Your iRedMail server is now installed. Reboot your system to enable all services.

Access iRedMail

To access the iRedMail admin panel, visit https://ired.linuxbuz.com/iredadmin/. You will see the login page:

Admin Login Page

Provide your administrative username and password, then click Login to access the dashboard:

iRedMail Admin Dashboard

Visit https://ired.linuxbuz.com/mail/ to access iRedMail’s webmail. The Roundcube login screen will appear:

Roundcube Login

Enter your credentials and click LOGIN to proceed to the dashboard:

Roundcube Dashboard

To access Netdata for monitoring, navigate to https://ired.linuxbuz.com/netdata/. You’ll see the login page:

Netdata Login

Enter your credentials and click Sign in to see the Netdata dashboard:

Netdata Dashboard

Conclusion

Congratulations! You have successfully installed and configured the iRedMail server on CentOS 8. You can now explore and manage user accounts. For any questions, feel free to ask.

FAQ

1. What is iRedMail?

iRedMail is a free, open source mail server solution supporting the Linux operating system. It offers secure email services and a user-friendly web interface.

2. Why do I need to disable SELinux?

Disabling SELinux is recommended as it can interfere with the installation and functioning of iRedMail on your system.

3. Can I change the database backend after installation?

It is possible but not straightforward. It would typically require reinstalling iRedMail or migrating existing data to a new database backend.

4. How can I access the iRedMail admin panel?

You can access the admin panel by navigating to the URL https://ired.linuxbuz.com/iredadmin/ in your web browser and logging in with your credentials.