How to Setup IRedMail Server on Ubuntu 18.04 LTS

iRedMail is a free, open source mail server solution that automatically installs and configure all necessary mail server components on your server. iRedMail allows you to create as many mailboxes as you want through their built-in web interface. It provides a web-based interface for managing mails, folders, sieve filters. It uses OpenLDAP, MySQL, MariaDB, PostgreSQL to stores mailboxes. IRedMail server is made from several components including, Postfix, Dovecot, Nginx, OpenLdap, Amavised, SpamAssassin, ClamAV, Roundcube, SOGo, Netdata and Fail2ban.

In this tutorial, we will learn how to set up a full-featured mail server with iRedMail on Ubuntu 18.04 server.

Requirements

  • A server running Ubuntu 18.04.
  • A static IP address 192.168.0.101 is setup on your server.
  • A root password is setup to your server.

Getting Started

First, you will need to update your server with the latest version. You can do it with the following command:

apt-get update -y
apt-get upgrade -y

Once your server is updated, restart your system to apply all the changes

Next, you will need to setup FQDN on your server. You can do it with the following command:

hostnamectl set-hostname test.example.com

Next, open /etc/hosts file and add the following line:

nano /etc/hosts

Add the following line:

192.168.0.101 test.example.com test

Save and close the file, when you are finished. Then, run the following command to apply all the changes:

hostname -f

Once you have done, you can proceed to the next step.

Install iRedMail

First, you will need to download the latest version of the iRedMail installer from their website. You can download it with the following command:

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

Once the download has been completed, extract the downloaded file with the following command:

tar xjf iRedMail-0.9.9.tar.bz2

Next, change the directory to iRedMail-0.9.9 and run the installer with the following command:

cd iRedMail-0.9.9
bash iRedMail.sh

During the installation, you will be asked to answer several questions to setup iRedMail mail server.

First, you should see the welcome screen as shown below:

iRedMail Installer

Now, press Enter button. You should see the following page:

Mail Storage path

Here, provide a full path where you want to store mailboxes. Then, click on the Next button. You should see the following page:

Choose web server

Here, select Nginx as a web server and click on the Next button. You should see the following page:

Choose database server

Here, select MariaDB as a database and click on the Next button. You should see the following page:

Enter MariaDB root password

Here, provide a MariaDB root password and click on the Next button. You should see the following page:

Set domain name

Next, provide your domain name and click on the Next button. You should see the following page:

Set postmaster password

Next, set the password for mail domain administrator and click on the Next button. You should see the following page:

Select Tools

Next, select all the tools and click on the Next button. You should see the following page:

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

* Storage base directory:               /var/vmail
* Mailboxes:                            
* Daily backup of SQL/LDAP databases:   
* Store mail accounts in:               MariaDB
* Web server:                           Nginx
* First mail domain name:               example.com
* Mail domain admin:                    [email protected]
* Additional components:                Roundcubemail SOGo netdata iRedAdmin Fail2ban

< Question > Continue? [y|N]y

Now, review all the options you have chosen. Then, type y and press Enter to proceed the installation. Once the installation has been completed successfully. You should see the following output:

*************************************************************************
* iRedMail-0.9.9 installation and configuration complete.
*************************************************************************

< Question > Would you like to use firewall rules provided by iRedMail?
< Question > File: /etc/default/iptables, with SSHD ports: 22. [Y|n]n
[ INFO ] Skip firewall rules.
[ INFO ] Updating ClamAV database (freshclam), please wait ...
ERROR: /var/log/clamav/freshclam.log is locked by another process
********************************************************************
* URLs of installed web applications:
*
* - Roundcube webmail: https://test.example.com/mail/
* - SOGo groupware: https://test.example.com/SOGo/
* - netdata (monitor): https://test.example.com/netdata/
*
* - Web admin panel (iRedAdmin): https://test.example.com/iredadmin/
*
* You can login to above links with below credential:
*
* - Username: [email protected]
* - Password: admin123
*
*
********************************************************************
* Congratulations, mail server setup completed successfully. Please
* read below file for more information:
*
*   - /root/iRedMail-0.9.9/iRedMail.tips
*
* And it's sent to your mail account [email protected].
*
********************* WARNING **************************************
*
* Please reboot your system to enable all mail services.
*
********************************************************************

Now, restart your server to enable all mail services with the following command:

reboot

Next, you will also need to remove iRedMail config file after the installation. Because, it contains usernames and passwords. You can delete it with the following command:

rm -rf /root/iRedMail-0.9.9/config

You can also check the log with the following command:

tail -f /var/log/mail.log

You should see the following output:

May 25 03:24:26 ubuntu1804 postfix/master[2379]: daemon started -- version 3.3.0, configuration /etc/postfix
May 25 03:24:32 ubuntu1804 amavis[983]: starting. /usr/sbin/amavisd-new at test.example.com amavisd-new-2.11.0 (20160426), Unicode aware, LC_ALL="C", LANG="en_US.UTF-8"
May 25 03:24:37 ubuntu1804 amavis[2434]: Net::Server: Group Not Defined.  Defaulting to EGID '122 122'
May 25 03:24:37 ubuntu1804 amavis[2434]: Net::Server: User Not Defined.  Defaulting to EUID '118'
May 25 03:24:37 ubuntu1804 amavis[2434]: No ext program for   .F, tried: unfreeze, freeze -d, melt, fcat
May 25 03:24:37 ubuntu1804 amavis[2434]: No ext program for   .zoo, tried: zoo, unzoo
May 25 03:24:37 ubuntu1804 amavis[2434]: No decoder for       .F
May 25 03:24:37 ubuntu1804 amavis[2434]: No decoder for       .zoo
May 25 03:24:37 ubuntu1804 amavis[2434]: Using primary internal av scanner code for clamav-socket
May 25 03:24:37 ubuntu1804 amavis[2434]: Found secondary av scanner clamav-clamscan at /usr/bin/clamscan

Next, you will need to update the ClamAV database manually.

First, stop the freshcalm service with the following command:

systemctl stop clamav-freshclam

Next, update the ClamAV database with the following command:

freshclam

You should see the following output:

Sat May 25 03:31:35 2019 -> ClamAV update process started at Sat May 25 03:31:35 2019
Sat May 25 03:31:35 2019 -> ^Your ClamAV installation is OUTDATED!
Sat May 25 03:31:35 2019 -> ^Local version: 0.100.3 Recommended version: 0.101.2
Sat May 25 03:31:35 2019 -> DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav
Sat May 25 03:31:35 2019 -> main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Sat May 25 03:37:55 2019 -> Downloading bytecode.cvd [100%]
Sat May 25 03:38:02 2019 -> bytecode.cvd updated (version: 328, sigs: 94, f-level: 63, builder: neo)
Sat May 25 03:38:03 2019 -> *Can't query bytecode.328.93.1.0.6810DB54.ping.clamav.net
Sat May 25 03:38:17 2019 -> Database updated (6146486 signatures) from db.local.clamav.net (IP: 104.16.219.84)
Sat May 25 03:38:17 2019 -> ^Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory

You can also read /root/iRedMail-0.9.9/iRedMail.tips file to find more information about your mail server.

Once you have done, you can proceed to the next step.

Access iRedMail Web Interface

iRedMail is now installed and configured. It's time to access their web interface.

Open your web browser and type the URL https://test.example.com/iredadmin. You may receive certificate warnings due to self-signed certificate is used by default. You will be redirected to the following page:

iRedMail Login

Now, provide your username and password. Then, click on the Login button. You should see the following page:

iRedMail Dashboard

You can also access the Roundcube webmail to read the emails that were generated after the installation. Type the URL https://test.example.com/mail to access the Roundcube webmail.

Congratulations! you have successfully installed and configured iRedMail on your Ubuntu 18.04 server. You can now easily create user mail accounts through a web browser. Feel free to ask me if you have any questions.

Share this page:

8 Comment(s)