How to Set up iRedMail Server on a Linux ECS Server

An Overview of iRedMail

The iRedMail includes a shell script that will get the components necessary for your email server running in your ECS instance. The process is rather simple and automatic and eliminates nearly all manual processes for setting up a mail server. It supports common operating systems such as CentOS, Ubuntu, and OpenBSD. The most notable features in the iRedMail are as follows:

  • It is constituted of open source packages mostly.
  • It incorporates a secure transport layer as a default and supports HTTPS webmail as well as SMTP/IMAP.
  • It allows you to create virtually unlimited mailboxes using a simple-to-use panel.
  • You have plenty of option for mail storage including PostgreSQL, OpenLDAP as well as MySQL
  • Postfix SMTP server
  • Dovecot IMAP
  • Apache
  • Nginx
  • iRedAPD Postfix policy server
  • OpenLDAP, ldapd
  • MySQL/MariaDB, PostgreSQL
  • Amavised-new
  • SpamAssassin
  • ClamAV
  • Roundcube webmail
  • SOGo Groupware
  • Fail2ban
  • Awstats

Requirements for Installation

The first consideration is the specifications for your ECS instance. You should have at least 2GB of RAM on your server as the installed components take up to a GB of your RAM. Another thing to consider is if there are other components installed: it is recommended that you have a separate VPS for your websites and blogs lest you risk breaking your installations. With that in check, let us now get to the actual process of installing iRedMail:

sudo apt update
sudo apt upgrade

The Installation Process

FQDN Setup

FQDN stands for fully qualified domain name, and this step involves the setting up of a hostname to run on our ECS instance. This step is very crucial as it will be the cornerstone of your emailing service. Run the command indicated below to see the current hostname:

hostname -f
sudo nano /etc/hostname
sudo hostnamectl set-hostname
sudo nano /etc/hosts localhost
hostname -f

MX Record

MX records are particularly important in email forwarding since they help resolve email hosts. For instance,'s email host can be When sending an email to's server, its MX record will first be queried to figure out the emails host for that server. The A record will the be queried to resolve the target IP address so that the email can be sent .

Record Type    Name      ValueMX             @
Record Type    Name     ValueA              mail     Server-IP

SELinux Configuration

Now, in this step, we shall disable SELinux so that iRedMail can successfully run in our VPS. It is noteworthy that the two are incompatible and our mail server will not work until the SELinux is disabled.

sudo nano /etc/selinux/config

iRedMail Download

In this step, we shall download iRedMail to our VPS from the official download page. As a rule, always work with the most stable version rather than the most recent. Once that is done, unpack the files in a folder in readiness for the installation process:

tar xjf iRedMail-0.9.8.tar.bz2
sudo rm -r iRedMail-0.9.8.tar.bz2

iRedMail Installation

We already have all the necessary components for the installation process. We shall not dwell so much on the questions that you shall be required to answer during this process because they are all straight-forward. Run the command below for this next step:

cd iRedMail-0.9.8

Steps to Follow

After you run the commands above, you will be prompted to press Enter to accept the installation. You will also be required to set the path for mailbox storage or simply leave the default at /var/vmail.

sudo ufw enable
sudo ufw reload
systemctl reboot
sudo nano /root/iRedMail-0.9.8/

Advantages of Using iRedMail

If you opt to use iRedMail, you will enjoy a number of features that you will find useful. Some of the most notable of these are as discussed below:

  • There are no setup costs, save for the ECS costs, for a fully fledged and featured mail server, that is, unless you want the enterprise edition.
  • iRedMail is compatible most Linux distributions making it very accessible. You can deploy it in Ubuntu, Red Hat, CentOS, Debian, Free BSD as well as Open BSD.
  • It comes pre-packaged with calendar (CalDAV) and contact (CardDAV) services out of the box.
  • It is both easy to deploy, unsophisticated and does not need specialized maintenance.
  • You can create virtually unlimited mail accounts on your server.
  • You can choose your backend from up to four different options (OpenLDAP, MySQL, MariaDB, and PostgreSQL).
  • Integrated features for mail restrictions
  • Integrates a feature for the sender and receiver throttling
  • Integrates security features such as anti-spam ware and anti-malware.
  • Comes pre-packaged with Webmail’s mail management tools such as AJAX, vacations, filters and address books.
  • You can easily port or save a copy of your deployed instance in a reproducible server setup.
  • Having your own mail server is very advantageous for privacy since all data is within your control.
  • iRedMail uses open source components that are both free to use and updated regularly. The vendors run routine fixes and upgrades and are independent of the iRedMail project.
  • Finally, it is compatible with both virtualized environments such as KVM, HV, VMware or non-virtualized environments and for both 32-bit and 64-bit distributions.


Congratulations for making it this far, you have successfully deployed your mail server. Access the iRedAdmin via and then login using the credentials you created during the installation process If you want to test if the configurations work properly, you may want to use services such as Mail Tester. Mail Tester is used by many developers to check what aspects of their configurations need some improvements.

Original Source



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: