We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Mailu mail server on Ubuntu 22.04|20.04|18.04

Learn how to – Install Mailu mail server on Ubuntu 22.04|20.04|18.04.

Mailu is a simple but powerful mail server running on docker containers. It is a free software open to suggestions and contributions. It is meant to provide an easy email server set up. Mailu images should run on any cloud server running Docker (>= 1.11) and you can choose between Docker compose, Kubernetes and Rancher to run your Mailu mail server. In this guide we will help users install and configure Mailu mail server on Ubuntu 22.04|20.04|18.04 Linux system.

Features of Mailu Mail server

Just like any other mail server, mailu is expected to meet the requirements of sending and receiving emails. The following are some of the most important features of Mailu mail server:

  • Standard email server, IMAP and IMAP+, SMTP and Submission
  • Advanced email features, aliases, domain aliases, custom routing
  • Web access, multiple Webmails and administration interface
  • User features, aliases, auto-reply, auto-forward, fetched account
  • Admin features, global admins, announcements, per-domain delegation, quotas
  • Security, enforced TLS, Letsencrypt!, outgoing DKIM, anti-virus scanner
  • Antispam, auto-learn, greylisting, DMARC and SPF
  • Freedom, all FOSS components, no tracker included

Hardware requirements

Your server should have adequate hardware requirements (virtual or physical). The minimal required memory and swap are as below:

  • When using antivirus (clamav):
    • 3GB of memory
    • 1GB of swap
  • When not using antivirus (clamav):
    • 1GB of memory
    • 1GB of swap

Set up Mailu mail server on Ubuntu 22.04|20.04|18.04

Update your system packages before installations

sudo apt update
sudo apt -y full-upgrade

Reboot if required after the upgrade:

[ -f /var/run/reboot-required ] && sudo reboot -f

We need to ensure that our system has a valid IP address and a fully qualified domain name. There should also be valid mx record for our domain. To set server IP and hostname, run the below commands:

sudo hostnamectl set-hostname mail.example.com 

Also add a server’s FQDN and IP address to /etc/hosts file.

$ sudo vim /etc/hosts
62.15.116.167 mail.example.com 

Logout and back in for new hostname to be reflected:

exit

Validate hostname setting:

$ hostname
mail.example.com

The following ports should be allowed through your system firewall as they are critical for emails. You can open the ports with ufw as shown below:

sudo ufw allow proto tcp from any to any port 25,80,443,110,143,465,587,993,995

Install Docker and Docker compose on Ubuntu

To install docker and docker compose on Ubuntu, please check our guides on below.

Generate Docker Compose files for running Mailu

After installing Docker and Docker Compose, proceed to create a directory where mailu will store its data.

sudo mkdir /mailu

Mailu uses a docker-compose.yml file and also relies on mailu.env for various settings. You need to generate a Mailu configuration for your environment using the online mailu set up utility. The generator will give you both a docker-compose.yml and a mailu.env file.

Generate both files can be generated by the mailu setup utility.

Step 1 – Pick a flavor

Pick your installation flavor from the list

Step 2 – Initial configuration

Set required variables in this step

Step 3 – Pick some features

Pick extra features you would like to enable.

Step 4 – expose Mailu to the world

Provide Docker network to use and other parameters

For IPv4 listen address, replace 127.0.0.1 with your server Public IPv4 address.

Also select database of choice.

Download generated Mailu configuration files

Once the configuration is generated, you will receive links to use for downloading the files. Ensure that you download the files in the mailu directory. You should get a page like this when generating the files

Downloading with wget command line utility.

sudo -i
mkdir /mailu
cd /mailu
wget https://setup.mailu.io/<replace-with-yours>/docker-compose.yml
wget https://setup.mailu.io/<replace-with-yours>/mailu.env

You can view the contents of mailu.env with the following commands:

$ vim mailu.env
##Update timezone
TZ=Africa/Nairobi

And the docker-compose file contents;

vim docker-compose.yml

When done with the settings, run mailu with docker compose as below in mailu directory

# docker-compose -p mailu up -d 
[+] Running 12/12
 ⠿ Network mailu_default        Created                                                                                                                                                          0.0s
 ⠿ Container mailu-resolver-1   Started                                                                                                                                                          0.5s
 ⠿ Container mailu-front-1      Started                                                                                                                                                          1.8s
 ⠿ Container mailu-webdav-1     Started                                                                                                                                                          1.5s
 ⠿ Container mailu-antivirus-1  Started                                                                                                                                                          1.6s
 ⠿ Container mailu-fetchmail-1  Started                                                                                                                                                          1.2s
 ⠿ Container mailu-redis-1      Started                                                                                                                                                          1.6s
 ⠿ Container mailu-imap-1       Started                                                                                                                                                          2.7s
 ⠿ Container mailu-smtp-1       Started                                                                                                                                                          2.7s
 ⠿ Container mailu-antispam-1   Started                                                                                                                                                          2.8s
 ⠿ Container mailu-admin-1      Started                                                                                                                                                          2.2s
 ⠿ Container mailu-webmail-1    Started                                                                                                                                                          3.2s

Set admin user by running the below command:

$ docker-compose -p mailu exec admin flask mailu admin admin <Your-Domain> PASSWORD
created admin user

This creates a user called admin@example.com with admin rights.

Configure Mailu Mail Server on Ubuntu 22.04|20.04|18.04

Once done, access Mailu web portal using your hostname: https://mail.example.com. You should get a page to login with you administrator password.

You can login to Webmail client or Login to Admin web console.

Once you login, you should see a page as below.

Ensure to update your password to a stronger one by clicking on ‘update password‘.

Create domains Mailu

To add a domain, click on domain→ new domain

Create users Mailu

To create users, click on Mail domains. Under manage, click on mailbox icon which takes you to user list. Click on Add user

Mailu Webmail

For my installation,I chose to use roundcube for webmail. Access webmail to start sending emails. Click on webmail which then directs you to roundcube login page.

That’s it for setting up Mailu mail server on Ubuntu 22.04/20.04/18.04. I hope it is helpful to you. Check more interesting Linux guides for your daily installations:

Cart

Your Cart is Empty

Back To Shop