How to Install and Setup iRedMail Mail Server on Ubuntu 18.04 LTS

0
7327

Welcome to our tutorial on how install iRedMail mail server on Ubuntu 18.04 LTS.
iRedMail is an opensource 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.

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 example 192.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

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 simply copy the download link and run the command below to download it on the server;

wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.8.tar.bz2

Extract the iRedMail tarball

tar xjf iRedMail-0.9.8.tar.bz2

Launch iRedMail mail server installer

Navigate to iRedMail source directory and run the installer script as shown below;

cd iRedMail-0.9.8
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.

iredmail-welcome-screen

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.

iredmail-mail-storage-path

After that, select Next to choose the web server to use. In this case, am going with the default, Nginx.

iredmail-web-server

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.

iredmail-mysql-backend

Next, you need to the set the MySQL root user password on the localhost server (127.0.0.1)

iredmail-mysql-root-password

After that, proceed to the next screen to set your first mail domain.

iredmail-mail-domain

Set the password for the mail domain administrator. [email protected] is configured by default.

iredmail-domain-password

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.

iredmail-optional-components

You are then required to review all the options you have chosen. iRedMail will install and configure the appropriate packages.

iredmail-setup-review

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 freshclam

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.

iredmail-admin-panel-login-page

When you login, you will land of iRedMail Dashboard.

iredmail-admin-panel

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/.

iredmail-roundcube-login roundcube-dashboard

You may also be interested in our article on how to install and setup Roundcube Webmail on Debian 9.

Well, that is all about installing iRedMail mail server on Ubuntu 18.04. In our next tutorials, we will be covering how to create user mail accounts as well as how to secure your iRedMail mail server so that emails cannot be marked as spam by other mail servers. We hope this was informative. Stay connected.

LEAVE A REPLY

Please enter your comment!
Please enter your name here