How to Install iRedMail Server on Ubuntu 20.04

iRedMail is a feature rich opensource mail server for Linux distribution. It can run on RedHat, Ubuntu, CentOS, Rocky Linux, Debian, FreeBSD and OpenBSD. There are other mail server solutions such as Mail-in-a-Box and modoboa.

iRedMail features include spam filtering, TLS/SSL, webmail, calendar, unlimited accounts, web admin panel. It can be deployed easily and it is completely free.

In this tutorial we learn how to install iRedMail on Ubuntu 20.04.

Prerequisites

  1. Fresh Ubuntu server 20.04 with minimum 4GB memory
  2. Sudo privileged user account or root user access
  3. Internet access to download packages.
  4. Fully qualified domain name (FQDN)
  5. A public Static IP address
  6. Port 25 opened

iRedmail support services such as Postfix, Dovecot, Nginx/Apache. Backend supported are MariaDB, PostgresSQL and OpenLDAP.

First, Update ubuntu server:

$ apt-get update -y

Now change the hostname of the server as your email domain.

Here I have used mail.websitefortesting.com as the hostname.

$ hostnamectl set-hostname mail.websitefortesting.com

Now open hosts file and configure hostname as:

$ vim /etc/hosts

45.56.112.153 mail.websitefortesting.com mail

Download iRedMail package

The installation package of iRedmail can be downloaded from the official download page of iRedmail.

In the terminal, the package can be downloaded using the wget command:

$ wget https://github.com/iredmail/iRedMail/archive/1.4.0.tar.gz

At the time of writing this tutorial iRedMail version 1.4.0, you may have a different version when you attempt to install, so change the URL accordingly.

Install iRedMail on Ubuntu

Once the package is downloaded, extract the package in the same directory:

$ tar -xvzf 1.4.0.tar.gz

Now we are ready to install iRedMail using bash script. Go to the extracted directory, find the file named "iRedMail.sh" and give it executable permission. Run the executable script to start the installation.

$ cd iRedMail-1.4.0

$ chmod +x iRedMail.sh

$ ./iRedMail.sh

Once the installation script is executed, a welcome screen wizard will be prompted. Click "Yes" and continue the installation.

iRedMail welcome screen wizard

In the next step, default mail storage path window will be appeared. You can set your desired directory as a mail storage path. Click "Next" to accept the default storage path.

iRedMail mail storage path

In the next window, an opportunity will be provided to select the webserver or run the mailserver without the webserver. Select "Nginx" using the space key to install a web server and click "Next"

Selecting Nginx as a webserver

In the next window prompt, you will be asked to select the database. In this example, I have selected MariaDB as a database server. You can select your backend server accordingly. After selecting the database server, the next step is to set up a database administration password and click "Next"

Selecting database server

In the next window , a wizard will be appeared to set email domain name. Remember that you can not set the server's hostname as the email domain.

iRedmail mail domain name'

Now provide password for the mail domain administrator and click Next.

iRedmail email domain password setup

In the next window, you can choose some of the optional components for installation. Use the space key to select the component and click Next

iRedmail optional components

Finally, the pre-installation configuration has been completed. In the terminal, you will be asked whether to continue the installation or not. Type "y" and enter to finalize the installation.

Final installation confirmation

It takes some time to complete the installation. Once the installation is completed, you will be asked to use firewall rules provided by iRedMail. If you have enabled a firewall on your system, press "y" and enter.

iRedmail firewall rule

After completing the installation, URLs of the installed web applications will be listed which includes webmail URL and iRedmail web admin panel URL

iRedmail web URLs

As recommended in the installation, reboot the operating system using the following command.

$ reboot now

SSL Certificate Install

iRedmail by default, install a self signed SSL certificate. With that browser warn that certificate is not trusted. To avoid warning message either buy a SSL certificate or install the free Let's Encrypt certificate.

For certificate from trusted vendor

First, rename the default certificate and key, type:

$ sudo mv /etc/ssl/certs/iRedMail.crt{,.bak}
$ sudo mv /etc/ssl/private/iRedMail.key{,.bak}

Copy the SSL certificate and key from trusted vendor to the respective directory:

$ sudo cp fullchain.pem /etc/ssl/certs/iRedMail.crt
$ sudo cp privkey.pem /etc/ssl/private/iRedMail.key

For Let's Encrypt certificate

The Lets Encrypt certificate created are created under /etc/letsencrypt/live/<domain>/ and archived under /etc/letsencrypt/archive/<domain>/.

Change permission for above directory to 0644 so other applications can access them.

$ sudo chmod 0755 /etc/letsencrypt/{live,archive}

Move the existing iRedmail certificates as done before and then create a symbolic link:

$ sudo ln -s /etc/letsencrypt/live/yourdomain/fullchain.pem /etc/pki/tls/certs/iRedMail.crt
$ sudo ln -s /etc/letsencrypt/live/yourdomain/privkey.pem /etc/pki/tls/private/iRedMail.key

Access iRedMail Admin panel

Once the system is back from reboot, browse iRedMail admin panel and the credentials created in the previous steps.

https://your_domain.com/iredadmin/
iRedmail admin login

With the valid credentials, you will get to the iRedmail control panel from where you can create new domains, new accounts and perform administrative tasks.

iRedmail admin control panel

Access iRedMail webmail

To access webmail for mailbox, send and receive emails use the following URLs and provide login credentials.

Roundcube webmail:

 https://your_domain/mail/

SOGo groupware:

https://your_domain/SOGo
iRedmail webmail login
iRedmail webmail

Conclusion

In this tutorial we learned how to install iRedMail server on Ubuntu 20.04. If you have any feedback and suggestion please comment below.

Leave a Comment