Ubuntu – How to install a mail server on Ubuntu with Modoboa

In this article, we will discuss a quick and dirty installation guide of a Linux mail Server. Indeed, in our Lab infrastrucure, while testing some scenario, we needed to have basic mail functionality. Instead of going with the standard Exchange Mail Server, we wanted to see if Linux can provide some “simple to use” mail software solution. As you can guess, we have found a lot of options and we have not tested all of them.


This post will be focusing on Modoboa software solution which provide free and open-source mail server capability and provide also a simple to use installer wizard. Modoboa is using Python and nginx web server software solution. The Modoboa solution aggregating different pieces of existing software (like DoveCot, Postfix, spamassassin…) into a really simple to use solution.

So, let’s give it a try and see how easy it is…


In this post, we will provide a really basic installation process of Modoboa Mail Server. In order to follow this post, we assume that

  1. access to internet to download necessary package
  2. you have installed fresh Ubuntu 22.10 Desktop Computer (Previous version of Ubuntu should work as well)
  3. you have no software installed on the Ubuntu 22.10.
  4. you have access to a working DNS infrastructure

Initial Preparation

In our scenario/infrastructure, we have an Active Directory up and running. The active Directory domain is already hosting a DNS Infrastructure. We will take advantage of this existing DNS infrastructure and create a domain namespace for our future email server. This Domain namespace will host criticial DNS Record to have Modoboa working correctly. This step is quite important because it will really simplify the installation and the access of your new email server


Step 1 – Create necessary DNS records

As you can see in the screenshot below, in our AD DNS server, we have created the mydomain.lab zone. Within this dns zone, we have created 2 Records

  • A Records
  • MX Record

You can use whatever name you want. To keep it simple, we have created the mail.mydomain.lab entries (for A and MX record) (for A and MX record). These records needs to point to the IP address of the future Modoboa Mail server which is basically your Ubuntu 22.10 computer.

You may test your setup by pinning these records and your Ubuntu computer should be answering accordingly


Step 2 – Setup DNS client Configuration on Ubuntu

So, we have to move the the Ubuntu 22.04 system and we have to configure it in order to leverage the AD DNS infrastructure. This step is extremely easy. Under Ubuntu Settings, go to the network tab and adjust the settings for the wired networks. Navigate to the IPV4 tab and confirm that the DNS server IP Address set there is truly pointing to your DNS server (in our instance, we are indeed pointing to IP address . 80)

Step 3 – Change the Ubuntu hostname

Finally, in order to retain some consistency, we will also configure a FQDN for our Ubuntu system. To perform this simple operation, we will use the following command


sudo hostnamectl set-hostname <%yourHostname%>.



We can also now add an A record in our DNS that will be pointing to this machine…


At this stage, our DNS infrastructure is completed. We can double check that hostnames and FQDN names can be resolved. If everything is ok, it’s time to move to the next step….


Installation – Step by Step Instructions

In this stage, we will obtain the necessary sources files needed to build up the mail server. Before beginning the installation, we will need to confirm that our Ubuntu 22.04 computer has all the essential components installed. Well, let’s proceed


Install prereqs

As Modoboa is built in Python, we will need to ensure that the following packages are present on our workstations. Now, let’s give the following command and if they are lacking, this will perform the installation


sudo apt-get install python3-virtualenv python3-pip

Download the Modoboa installer

In this stage, we only need to get the installer file. This stage is likewise pretty easy. From a Terminal Console, issue the following command


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

When the download is completed, you will need to transfer the Modoboa folder. As you can see in the screenshot below, we issue the cd command to relocate to the spot where the folder has been downloaded


cd modoboa-installer folder\sModoboa 04


Run the installation

Once inside the Modoboa-installer folder, it’s time to execute the installer script. The script can be run with or without switches. We have observed in a number of postings and documentation that it’s kind of recommended to first construct your configuration file first. To do that, we will issue the following command in the Terminal Console


#Replace the mydomain.lab with the name of your own domain mail namespace !!!

sudo python3 ./run.py —stop-after-configfile-check mydomain.lab


After executing this command, you will be alerted that a configuration file has been created for you. Hence, to personalize your installation, you will need to alter the installer.cfg just produced




Time to review the configuration file.

You can choose to utilize self signed certificates or use the Let’s encrypt. Since we are operating in a lab infra, we have selected the self-signed option. You can also check that the email address for your mail domain is set correctly. Finally, you can also select the backend database (postgres or mysql) (postgres or mysql). The option is up to you. In our test installation, we didn’t change much in this configuration file. As shown in the screenshot, we have merely supplied an email address for our own mydomain.lab namespace

When you are done with the changes, you can run the installer mode with no switches and the script will perform the installation. Thus, on a terminal Console, issue the following command

#Adjust the mydomain.lab to reflect your own infra domain namespace !!!

sudo python3 ./run.py —interactive example.com



You have to confirm that you wish to perform the installation. Press Y


The installation will proceed and can take some times. In our lab, we had to wait about 10 to 15 minutes for the installation to complete. If everything went smoothly, you will notice on your screen a successful installation notification. You will see also that some further information about how to access the Web interface (which url to use) and the initial user name and password.


Initial Configuration Activities

If you have reached this level, it signifies that the installation went through successfully. It’s now time to execute some basic configuration. Based on the screenshot above, in our specific circumstance, we will need to use the following initial information in order to progress with the configuration activities


url = https://mail.mydomain.lab

User = admin

Password = password

Accessing the web interface

Thus, to access the web interface of your freshly installed mail server, open your favorite browser and connect to the url provided during the installation process. Thus, in our example, we browse to https://mail.mydomain.lab. Since we are utilizing Self Signed certificates, we can end up with this warning notice. Press on the Advanced Button


Scroll down and select the option Take the risk and Proceed


After that, you will be finally visiting the login screen of the Web interface.

First Time Login – Admin Interface

Time to login. Again, when the installation has been completed, the wizard notified you that initial credentials were configured. Default credentials are admin/password



The first time you login, you will be taken to the Profile page. We strongly suggest you to change the default password and select a proper one


After editing your profile, you should be redirected the dashboard page. Here, you can start to explore a little bit the interface and try to grasp and become familiar with the software. You will see that you have an option to choose a new web interface layout as well


If you click on the button, you will be redirected to a new login page which display the new look’n feel and the new web interface


After login in, you will be routed to the Domain name page. If you try to to reach the Dashboard, you will see that it’s not yet ready and that the team behind the Modoboa software solution is still working on it.


To get back to the “old” interface, simply that the initial url provided by the wizard instation (in our instance, https://mail.mydomain.lab). As it seems that the new web interface is not entirely ready for big time, we have chosen to perform the remaining configuration actions through the old web interface…


Establishing your mail domain namespace

In this phase, we will construct SMTP domain namespace for our Mail server. Here, we will really present basic configuration information in order to demonstrate the process. Thus, in the dashboard page, click on the Domains Link on the top menu. In the domain page, click the Add button


A modal box will be displayed. Enter the needed information. Since we have no access to a DKIM feature, we have unchecked this box. This is probably not ideal pratice but remember we are only deploying this internal mail server for our Lab infrastructure. In production environment, you can wish to examine each settings to ensure that security is provided on your mail server.


In the next screen, you will given to create a (smtp) domain admin user. In our scenario, we have declined the option since we will be using the existing admin user that has already been created


If needed, you can create other domains name and proceed the same way. After you are done. It’s time to create a user and and mailbox 🙂


Building your first mailbox

To create your first mailbox, you only need to click on the Identities option on the top menu. Click on the Add + Button and select the Account option


A modal dialog box will be provided to you. Again, give the necessary information in order to create your first user mailbox. Hit Submit when done



When the dialog box closes, you will see the newly created mailbox object within your Modoboa Mail Server


User Experience

In this section, we will simply show how a user can access his mailbox. Several alternatives are available. The easiest is to utilize the Modoboa web interface. With the UI, a user will be able to read and write emails, browse a Calendar, create and retrieve contacts. Therefore, the web interface is actually workable. On the other side, it’s also feasible to utilize fat email client such as Thunderbird or outlook.


Accessing the mailbox using the web interface

As noted previously, a user can access his mailbox through the online interface. When a user navigate to the url of the Modoboa mail server, it will be greeted with a Login page


If the credentials are good, the user will access his profile page and the user can provide the essential information


When done, the user will finally have an access to his mailbox.


Clicking on Compose button, the user will be able to draft the email and sent it to the relevant recipient

As you can see, mail flow (from the web interface) is working accordingly. So, so far, it’s seems that our installation is totally working and we may proceed with other activities….

Accessing the mailbox with Thunderbird

Before closing this post, we wanted to test connectivity using Thunderbird email client. Thus, we started the Thunderbird and the small wizard starts as well. In the wizard, we simply supply the needed info and press Proceed

If everything is configured successfully, the wizard should come back with discovered configuration message. Click Done to complete the configuration


You could get a window about the SSL certificate. This is expected as we are utilizing a self signed certificate. Thus, accept the certificate and proceed


Thunderbird should now confirm you that the setting is completed and successful

At this time, you should have an access to your mailbox from thunderbird



For your own information, you can check the Server settings used by Thunderbird (Port used, name used…)


You can do the same and check the SMTP Outgoing setup. In this view, we notice that the port in use is.

To conclude our experiments, we have prepared a mail messages from thunderbird and send it


The test was successful as we received the mail in our Thunderbird mail client


Remember too that within Thunderbird, you may alter the theme to match your Ubuntu Theme… We are using Dark Theme in Ubuntu thus we have updated the Thunderbird theme as well and picked the Dark option…



Final Notes\sAnd Voila !


Modoboa is an interesting (and relatively straightforward to deploy) mail server solution that can run on top of a Linux computer. The Modoboa software package does a good job in disguising all the complexities of installing postfix, dovecot and all the other pieces that are part of the solution. Modoboa solution provides other features/capabilities such as LDAP integration, DKIM,… that we have not addressed.


This post was made since we just needed to have a mail server up and operating in our test lab. We could have used Exchange Server but we wanted to learn something new and we opted to go for Modoboa… This is the first time we have implemented a mail service solution on top of a Linux machine… It was not too difficult to get a mail server rapidly implemented within our infrastructure and it was fun.


Note that we have merely scraped the surface here. We have truly conducted the most basic installation. Hence, if you are going to utilize Modoboa as your main mail server solution, we would urge you to study the documentation and analyze if this solution will match your demands.






Leave a Reply

Your email address will not be published. Required fields are marked *