Last updated on July 5th, 2021 at 08:07 pm
Welcome to our tutorial on how to install and setup iRedMail mail server on Ubuntu 18.04 LTS. iRedMail is an open-source mail server solution. It provides a fully-fledged and fully featured mail server at no cost at all.
Some of the reasons why you may want to consider iRedMail for your mail server include;
- It enables you to have a complete control over your emails and their security, transaction logs…
- It is opensource and hence it easier to get the bug fixes and updates from your trusted Linux/BSD vendors.
- It uses secure connection protocols, POP3/IMAP/SMTP over TLS, webmail with HTTPS, by default.
- It provides an intuitive Web GUI for managing mails, folders, sieve filters.
- It supports backends such as OpenLDAP, MySQL, MariaDB, PostgreSQL.
You can read more about iRedMail features on iRedMail page.
Install and Setup iRedMail Mail Server on Ubuntu 18.04 LTS
Prerequisites
Before you can proceed, ensure that the following bare minimums are met;
- Install a FRESH Ubuntu 18.04 LTS server with NO mail related components installed.
- Provide the system with at least 2GB of RAM
- Ensure that the following User ID and Group ID are not being used; 2001,2002,2003
- Set a fully qualified domain name (FQDN) for your server e.g
mx.example.com
. You can set your hostname with the command below;sudo hostnamectl set-hostname mx.example.com
- Ensure that the hostname is resolvable. If you dont have a DNS server, set record in your
/etc/hosts
for example192.168.43.102 mx.example.com mx
. You can set this record by running the command below;echo "192.168.43.102 mx.example.com mx" | sudo tee -a /etc/hosts
Install iRedMail iRedMail Mail Server on Ubuntu 18.04 LTS
Once the above prerequisites are met, step through the following to install iRedMail mail server on Ubuntu 18.04 LTS
Ensure your server is up-to-date;
apt update apt upgrade -y
Once the server is updated, download the latest stable release of iRedMail from their Download page.
You can as well get the download link from Github releases page and download it with wget as shown below;
wget https://github.com/iredmail/iRedMail/releases/download/1.2.1/iRedMail-1.2.1.tar.gz
Extract the iRedMail tarball
tar xzf iRedMail-1.2.1.tar.gz
Launch iRedMail mail server installer
Navigate to iRedMail source directory and run the installer script as shown below;
cd iRedMail-1.2.1 bash iRedMail.sh
During the installation, you will be prompted to answer several questions required to setup iRedMail mail server. The setup is interactive and the first screen welcomes you and thank you for using iRedMail.
Press Enter to accept and proceed with the installation. As stated, you can press Ctrl+c cancel the installation. On the next screen, you are required to provide a full path where user mailboxes will be stored. The default path is /var/vmail
.
After that, select Next to choose the web server to use. In this case, am going with the default, Nginx.
Next, you are required to choose the backend to store your mail accounts. In this case, we are going to select MySQL database as our backend. Use up and down arrow keys move between the options. Press Space Bar to select your option.
Next, you need to the set the MySQL root user password on the localhost server (127.0.0.1)

After that, proceed to the next screen to set your first mail domain.
Set the password for the mail domain administrator. [email protected] is configured by default.
In the next screen, your are prompted to choose some of optional components that can be used to add extra functionalities your mail server. Select the components you required and press Next to proceed.
You are then required to review all the options you have chosen. iRedMail will install and configure the appropriate packages.
If all the options are fine, type y and press Enter to proceed with installation. After the installation, you are prompted on whether to use firewall rules provided by iRedMail. Type y and press Enter to accept. After that, restart firewall.
************************************************************************* * iRedMail-0.9.8 installation and configuration complete. ************************************************************************* < Question > Would you like to use firewall rules provided by iRedMail? < Question > File: /etc/default/iptables, with SSHD port: 22. [Y|n]y [ INFO ] Copy firewall sample rules: /etc/default/iptables. < Question > Restart firewall now (with SSHD port 22)? [y|N]y [ INFO ] Restarting firewall ... [ INFO ] Updating ClamAV database (freshclam), please wait ...
At the end of it, you will be presented with useful links to access various components of the iRedMail server.
******************************************************************** * URLs of installed web applications: * * - Roundcube webmail: https://mx.example.com/mail/ * - SOGo groupware: https://mx.example.com/SOGo/ * - netdata (monitor): https://mx.example.com/netdata/ * * - Web admin panel (iRedAdmin): https://mx.example.com/iredadmin/ * * You can login to above links with below credential: * * - Username: [email protected] * - Password: Ekmutibryof2 * * ******************************************************************** * Congratulations, mail server setup completed successfully. Please * read below file for more information: * * - /root/iRedMail-0.9.8/iRedMail.tips * * And it's sent to your mail account [email protected] * ********************* WARNING ************************************** * * Please reboot your system to enable all mail services. * ********************************************************************
You mail server is successfully setup. Restart your server to enable all mail services
systemctl reboot
You can also read the file, /root/iRedMail-0.9.8/iRedMail.tips, to find out more information about your mail server.
If your encounter the following error;
ERROR: /var/log/clamav/freshclam.log is locked by another process ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
It is because freshclam service is already running.
lsof | /var/log/clamav/freshclam.log
freshclam 15760 clamav 3wW REG 8,1 2181 277222 /var/log/clamav/freshclam.log
You can stop freshclam service and and update the ClamAV database manually
systemctl stop clamav-freshclam.service
There is also a SENSITIVE file that you need to pay attention to; /root/iRedMail-0.9.8/config
. This file contains usernames and passwords. Therefore, remove it immediately after the installation
rm /root/iRedMail-0.9.8/config
To access the iRedMail web admin Panel, use the URL, https://mx.example.com/iredadmin/
. You may encounter certificate warnings. This is because self-signed certificate is used by default. You should however consider obtaining a commercial SST/TLS certificate.
When you login, you will land of iRedMail Dashboard.
You can also login to Roundcube webmail to read the mails that were generated after the installation. To login to Roundcube, use the URL; https://mx.example.com/mail/
.
You may also be interested in our article on how to install and setup Roundcube Webmail on Debian 9.
Well, that is all about how to install and setup iRedMail mail server on Ubuntu 18.04 LTS.
Other tutorials
Configure Sendmail to Use Gmail Relay on Ubuntu 18.04/Debian 10/9
Configure Postfix to Use Gmail SMTP on Ubuntu 18.04