Setting Up a Mail Server on Debian 10 Using Modoboa

Modoboa is an open-source mail server hosting and management platform for Linux. Written in Python, it leverages Postfix and Dovecot to send and receive emails, integrates with an Nginx webserver, and utilizes a MySQL/PostgreSQL database. Modoboa allows you to create unlimited mailboxes and mail domains and can be paired with Let’s Encrypt to secure all communications between your email server and external networks. Featuring a web-based admin panel, Modoboa simplifies the management of domains, mailboxes, aliases, and more.

In this guide, we will walk through the steps to install Modoboa on a Debian 10 server.

Prerequisites

  • A server running Debian 10.
  • A valid domain name pointed with your server’s IP address.
  • A root password configured on your server with root access.

Getting Started

First, update your system packages to the latest versions with the following command:

apt-get update -y

Next, install the required dependencies using the command below:

apt-get install git curl gnupg2 wget -y

Then, set your system’s hostname with this command:

hostnamectl set-hostname modoboa.example.com

Install Modoboa

Download the latest version of Modoboa with the command below:

git clone https://github.com/modoboa/modoboa-installer

Upon downloading, navigate to the Modoboa directory and check the configuration using these commands:

cd modoboa-installer
./run.py --stop-after-configfile-check example.com

This will generate a configuration file named installer.cfg in your current directory.

Edit the configuration file with the following command:

nano installer.cfg

Modify these lines:

[certificate]
generate = true
type = letsencrypt

[letsencrypt]
email = your_email@example.com

[database]
engine = postgres
host = 127.0.0.1
install = true

Save and close the file. Start the installation with this command:

./run.py --interactive example.com

Upon successful installation, you should see a message confirming the components installed, such as:

Welcome to Modoboa installer!

Warning:
Before you start the installation, please ensure the following DNS records are configured for the domain 'modoboa.example.com':
  mail IN A   
       IN MX  modoboa.example.com.

Your mail server will be installed with the following components:
modoboa automx amavis clamav dovecot nginx razor postfix postwhite spamassassin uwsgi radicale opendkim
Do you confirm? (Y/n) Y
The process can be long, feel free to take a coffee and come back later ;)
Starting...
Generating new certificate using letsencrypt
Installing various components...
Congratulations! You can enjoy Modoboa at https://modoboa.example.com (admin:password)

Access the Modoboa Web Interface

Open your web browser and navigate to the URL https://modoboa.example.com. You should see the Modoboa login page:

Modoboa Login

Use the default credentials – username: admin, password: password – then click the Log in button. You will be taken to the Modoboa dashboard:

Modoboa UI

Notes

There is a known issue in the Modoboa installer, where you might encounter an ‘Internal Server Error’ after logging into the GUI. The workaround involves editing the file /srv/modoboa/instance/instance/settings.py

nano /srv/modoboa/instance/instance/settings.py

And changing the line:

USE_TZ = False

Then restart the uwsgi service by running:

service uwsgi restart

Reference: Modoboa Issue Tracker

Conclusion

In this guide, we explored the installation process of Modoboa on a Debian 10 server. You are now ready to add your domains and start sending emails through your newly set up mail server.

Frequently Asked Questions

What is Modoboa?

Modoboa is an open-source mail server platform that facilitates the management of mail services on Linux systems. It offers a web interface to manage domains, mailboxes, and more.

Is Modoboa suitable for a personal or a business email server?

Yes, Modoboa is versatile enough for both personal and business use, offering scalability to cater to unlimited mailboxes and domains.

Does Modoboa support encrypted communications?

Yes, Modoboa can be integrated with Let’s Encrypt to secure all communication with SSL/TLS encryption.

What if I encounter an ‘Internal Server Error’?

This is a known issue post-installation; you can resolve it by editing the /srv/modoboa/instance/instance/settings.py file as mentioned in the notes section and setting USE_TZ = False.