• Get In Touch
January 2, 2017

How to Install iRedMail on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

iRedMail is a free, Open Source Mail Server Solution. iRedMail uses other Open Source software to create a full-fledged and fully featured Mail Server. It uses Postfix, Dovecot, and MySQL/MariaDB to store virtual domains and users. It also supports Roundcube and SOGo Mail clients. iRedMail provides many features such as it is completely safe and secure as all its components are open source. Your privacy is completely protected as the application and data are stored on your own hard drive.

Requirements

iRedMail can be installed on a server with a minimal amount of RAM but it is recommended to have at least 2GB RAM for installing iRedMail. To follow this tutorial you will need a minimal CentOS 7 installation with sudo or root access on it. If you are logged in as non root user run sudo -i to switch to the root account. Additionally, you will also need a domain name pointed towards your server for mail exchange and other configuration.

Installing iRedMail

Before installing any package it is recommended that you update the packages and repository using the following command.

yum -y update

Now you need to change the hostname of your server, run the following command to set the hostname for your server.

hostname mail.yourdomain.com

You can verify the hostname using the following command.

hostname -f

You should see the following output.

[root@mail ~]# hostname -f
mail.yourdomain.com

Now you will need to disable your SELinux because iRedMail does not work with SELinux policies. To completely disable the SELinux you will need to edit /etc/selinux/config file.

nano /etc/selinux/config

If you don’t have nano installed, you can install it using yum -y install nano Find the following line:

SELINUX=enforcing

Change it to:

SELINUX=disabled

Now you will need to reboot your server so that the new configuration can take effect.

Not all the packages which are required to install iRedMail are included in the default yum repository. But these packages are available in the iRedMail repository, we can directly use the iRedMail repository to install the dependencies and the software. To install the required packages and software, iRedMail provides an automated script. Run the following commands to download the installer script.

cd /root
wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.5-1.tar.bz2

You can always check for the latest version of installer script by going to the download page of iRedMail.

Once you have downloaded the package, you can extract it using the following command.

bzip2 -d iRedMail-0.9.5-1.tar.bz2
tar -xvf iRedMail-0.9.5-1.tar

Change your current directory to your newly created directory. You can run the installer script using the following command.

cd iRedMail-0.9.5-1
sh iRedMail.sh

Once you run the script, it will automatically add the required repositories and run the installer, you will see the following screen with terms and conditions. You will need to accept the terms to proceed further.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1804891175.png” alt=”” />

If you accept the terms, you will see the following screen now. It will now ask you about the directory in which you will save the user mailboxes. You can leave the default mail directory here, which is var/mail.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1376349975.png” alt=”” />

Select Next to proceed further. It will now show you the interface to choose a web server to server for iRedMail’s webmail and admin interface. You will have to choose either Apache or nginx. Press space button to select the highlighted option.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1545513251.png” alt=”” />

Select Next to proceed further. In this interface, you will be asked about the database or backend technology to use to store the mail accounts. You can choose from LDAP, MariaDB or PostgreSQL. For ease of use and maintenance, you can select any of the database servers, which are MariaDB or PostgreSQL.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/963444361.png” alt=”” />

Select Next to proceed further. You will need to enter your first mail domain, make sure that it is not exactly same as your hostname of the server, although you can use any other subdomain or the main domain for the mail domain. If you enter the same domain as the hostname of your server, then some of the system related emails will not be routed to your mailbox.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/190797343.png” alt=”” />

Select Next to proceed further. In this interface, you will need to enter the password for your administrative email account. The administrative email account will postmaster@yourmainmaildomain.com. Make sure that you enter a password without any special characters in it. You will be able to change the password later.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/491822295.png” alt=”” />

Select Next to proceed further. Now you will need to choose the components to install. DKIM and SPF are enabled by default however you will need to set the DNS records for the DKIM and SPF. It is recommended that you select iRedMail, which will install the official web-based admin panel for iRedMail. You should also install Roundcubemail which is a webmail client written in PHP and AJAX. Further, you should also install Fail2Ban, which will automatically block an IP address to access the admin and webmail interface when too many login failures will occur. You can also choose to install SOGo which is a groupware consisting webmail, calendar, and address book. SOGo has a responsive and very good looking interface compared to Roundcubemail.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1202228980.png” alt=”” />

Once you click Next, it will show you the settings before installing and configuring iRedMail. Following is the example settings shown at the terminal before installing.

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

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

< Question > Continue? [y|N]y

If you want to continue with these settings, choose y. To configure the settings, choose n. If you choose yes, it will start installing the packages and configuring them according to the data provided. Further, the installer will also ask you if you want the installer to automatically configure the firewall for you. You should choose y unless you are setting up the firewall rules manually.

Once the installation finishes, you will see the following information in the terminal.

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

Once done, you will need to reboot your server to start the mail services. Run the following command for same.

shutdown -r now

Once the server is up again, you can run the following command to view your admin user account and password. The file also contains the database username and password as well as the password of database root user. As this file is very sensitive, you can either move it to very secure location or you can simply change its permissions so that it is not accessible by other users. Run the following command for same.

chmod 400 /root/iRedMail-0.9.5-1/iRedMail.tips

You can view the contents of the file using the following command.

cat /root/iRedMail-0.9.5-1/iRedMail.tips

In the contents of the file, you will find the DKIM information:

DNS record for DKIM support:

; key#1 1024 bits, i=dkim, d=example.com, /var/lib/dkim/example.com.pem
dkim._domainkey.example.com.        3600 TXT (
  "v=DKIM1; p="
  "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCu1gwhVl0tYy3g26yV32zkE+Kl"
  "VoVA+t6LTFOgN2Tz7GKCjwvIpRsvO30mlkDu+PWMX/iknLKIeAm7gi+n3FGW3N56"
  "sIki8kf+i877qh2lK2MW6MxxQQosY+LNxMbMUb3jvQNpdfh94RddIihZkQs7zQWG"
  "oYPugff7nbXFgdweFQIDAQAB")

You can use this DKIM entry to create a TXT record in the DNS settings of the domain. You will find the DNS entries for the domain in the DNS management panel of the domain.

To access the iRedMail administrative panel, go to the following link using your favorite web browser.

https://yourserverIP/iredamin

You will see the following interface. Use the email address postmaster@hostname as the email address and the password which you have created during the installation.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1460756848.png” alt=”” />

Once you are successfully logged in, you will see following interface.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/253491560.png” alt=”” />

You can click on Add link from the menu bar to add a new domain, admin or mail user.

You can now go to your favorite web browser to access the email interface provided by the iRedMail, the RoundCube webmail address for your mail server will be as follows.

https://yourserverIP/mail

You should see the RoundCube login interface. Once you are logged in using the admin credentials or any newly created user credentials, you should see following interface.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/2091107301.png” alt=”” />

To access the SOGo mail client interface, you can go to the following link on your favorite web browser.

http://yourserverIP/SOGo

You will see the following login interface.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/817939700.png” alt=”” />

Login using admin or mail user credentials, you will see following interface.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/25997172.png” alt=”” />

Conclusion

In this tutorial, we have learned how to create a fully featured Mail server with minimal configuration. You can now deploy iRedMail as a mail server solution for your organization.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]