ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

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

View Plans

How to Install iRedMail on CentOS 7

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.

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.

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.

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.

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.

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.

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.

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.

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

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.

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.

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

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, 20GB SSD VPS for £10.00 / month.

View Plans