How to Install iRedMail (Mail Server) on CentOS 7 / RHEL 7

iRedMail is out of the box open source mail server solution on Linux like operating system. The beauty of iRedMail is that it provides web based admin panel from where mail admin or system admins can do all email related operations task. Some of other features are listed below :

  • Support unlimited email accounts.
  • It provides Roundcube as webmail (MUA )
  • It used Postfix as MTA & Dovecot as MDA
  • It pvoides Calendar service via CalDAV & Contact service via CardDAV
  • It uses SpamAssassin for Spam scan and Amavis & Clamav for Mail virus scan.
  • OpenLDAP, MariaDB and PostgreSQL can be used to save mail accounts

In this article we will demonstrate how to install and configure iRedMail on CentOS 7 & RHEL 7. I am going to use followings for iRedMail setup.

  • OS = CentOS 7 or RHEL 7
  • Domain = nsitmail.com
  • Server Hostname = mail.nsitmail.com

Note : In case if you want mails from your mail server to be delivered in inbox not in spam folder then update the DNS records like A & PTR  before installation and TXT ( SPF & DKIM ) after installation.

Step:1 Set hostname and disable Selinux.

Set the proper hostname using hostnamectl command if it is not set.

[root@mail ~]# hostnamectl set-hostname mail.nsitmail.com
[root@mail ~]# hostname -f
mail.nsitmail.com
[root@mail ~]#

Update the /etc/hosts file

127.0.0.1 mail.nsitmail.com localhost.localdomain localhost

Disable Selinux

[root@mail ~]# setenforce 0

Edit the file /etc/sysconfig/selinux , set the parameter “SELINUX=disabled” , Reboot the server to disable selinux completely.

Step:2 Download the tar file of iRedmail.

Download the latest version of iRedmail from their Official Web Site or use below wget command to download from terminal.

[root@mail ~]# wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.3.tar.bz2

Step:3 Extract the tar file & execute installation Script.

[root@mail ~]# ll
total 124
-rw-r--r-- 1 root root 126277 Dec 20 19:12 iRedMail-0.9.3.tar.bz2
[root@mail ~]#
[root@mail ~]# tar -jxvf iRedMail-0.9.3.tar.bz2
[root@mail ~]# cd iRedMail-0.9.3
[root@mail iRedMail-0.9.3]# sh iRedMail.sh

After couple of seconds , below screen will appear , Select yes and press enter.

iRedmail-installation-welcome-message

Define the folder or directory where users mailbox will be stored.

iredmail-users-mailbox-location

Select the web Server for iRedmail. Default is Nginx.

Webserver-for-iRedmail

Select the database of your choice which will store domain names and mail accounts. In my case i am using MariaDB.

mariadb-iredmail

Define the domain name for your mail server. In my case domain name is “nsitmail.com

domain-name-for-iredmail

Set Password for postmaster account.

postmaster-password-iredmail

Select Optional Components of iRedmail installation

Select-optional-components-iredmail

Press “y” to continue installation, Mail Server info & Credentials are kept in the file “/root/iRedMail-0.9.3/config”. Please keep this file in secure place.

iredmail-credentials

iredmail-installation-completed

As per instructions , reboot the server to enable all mail services.

Postfix mail logs and iRedmail logs are stored in “/var/log/maillog” and “/var/log/iredapd/iredapd.log” respectively.

Note : Default administrator name is “[email protected]

Following are the Important URLs after the Installation is completed , replace the domain name as per your setup in mentioned URLs.

iRedAdmin – official web-based admin panel:

https://mail.nsitmail.com/iredadmin/

Username: [email protected], password: XXXXXXXXXX

Roundcube webmail URL :

http://mail.nsitmail.com/mail/

SOGo Groupware

https://mail.nsitmail.com/SOGo/

Step:4 Create Users & domain from Admin Panel.

To create users first login to admin panel. Use user name as “postmaster@<domain>” and password that we set during installation.

iRedmail-webadmin-panel

Dashboard-iredmail

Click on Add option and then Select Users.

Add-user-under-domain-iredmail

Add a new Domain :

From the admin Panel , Select “Domain & accounts” option and then click on Add domain

Domains-Accounts-iredmail

Define the domain name & Organization Name and then further we can create users on newly created domain.

Add-domain-iredmail

Step:5 Access Roundcube (Webmail).

Open the url in the browser “https://mail.nsitmail.com/mail/” , replace the domain name as per your setup.

Roundcube-Webmail-iredmail

Roundcube-Webmail-Inbox

Send a test mail to verify the functionality.

compose-mail-roundcube-iredmail

mail-from iredmail-on-gmail

As we see that i got the mail from iRedmail mail server, so we can say the iRedmail is successfully installed and configured.

16 thoughts on “How to Install iRedMail (Mail Server) on CentOS 7 / RHEL 7”

  1. thank you for your efforts but i have a problem when i wont to get to mail.nsitmail.com/iredadmin / i do not get the page of login that you’ve shown us.
    and thank you again

    Reply
    • Try accessing it with your Server’s IP address. In case you want to access it with hostname or DNS name , then you have to update your system hosts file with entries something like below

      IP_Address_of_Server DNS_Or_Hostname

      Reply
  2. Hi,

    Currently I have set the iredmail on local centos 7 server and its working fine. Now I have domain purchased. Now How can I configure the mail server for that domain. I have one static IP as well. But currently used that IP to different server.

    Also let me know if any IP forwarding required for that as currently that is running on local centos 7 server. Please help me to configure.

    Reply
  3. Hi,

    Add a Domain in your iredmail server from admin panel and assign the public IP address to your server and add a firewall rule in such a way that if any request comes on 25 port on your public IP it should redirect the request to server’s local ip.

    From your Domain Panel, configure DNS records like A, PTR and MX.

    Reply
  4. after follow the process i got this one
    This site can’t be reached

    mail.musicout.com’s server DNS address could not be found.
    Try running Network Diagnostics.
    DNS_PROBE_FINISHED_NXDOMAIN

    please help me

    Reply
  5. It seems like DNS records for your sever’s hostname ‘mail.musicout.com’ is configured properly. In your DNS server do A record entry of your mentioned hostname. In Case DNS server is not configured then do below entry in your system host file.

    IP_Address_of_Server mail.musicout.com

    Reply
  6. I currently install the iredmail on the local centos 7 server and it works fine. Now I have acquired domain. How can I configure the mail server for that domain. I have a static IP and it also publishes.

    I would also like to know how I could run it on the local centos 7 server. Please help me set it up.

    Reply
  7. Hi This was really useful . Thank you and I am planning to change my exchange server and use this as my mail server. Domain is active and I have the public IP configured . A firewall rule to point my exchange server is already there . So if I just create a same domain name and set the IP of my exchange server to this server, will everything work ..??

    Reply
  8. Hi Sandeep,

    – is your iredmail installation successful…?
    – Update your server’s hostname either in DNS or /etc/hosts file.
    – Also make sure https (443) port is allowed in OS firewall

    Reply
  9. Hello,

    I have installed iRedMail and I can send email without any problems but I can’t receive email. Would you happen to know of any reason this could happen?

    Thanks in advance,
    Gary B

    Reply
  10. Hi I installed the server following this tutorial. It worked perfect for last 6 months . But 2 days ago the end user told he gets thousands of Mail Delivery Failure messages being sent to his mail box. I suspect my server is sending lots of spam emails out and I get the logs saying my IP is black listed. I am planning to reinstall everything but how do I secure from the spam attacks again..? What about SpamAssassin ?? Will this prevent this..?? Configuring the linux firewall will help..?? Please please advise.

    Reply
    • Hi Manoj,

      It looks like one of the system from LAN is sending thousand of emails or spam emails to your mail server. This usually happens because of virus, check the email headers , there you will find the IP address of the affected system, disconnect it from the LAN and delete all emails from the queue. Try to whitelist your mail server public IP by sending whitelist request via portals.

      Enable & Configure SpamAssassin on your mail server and configure Linux firewall only if there is no hardware firewall in your env and allow only specific ports.

      Reply

Leave a Comment