Atlantic.Net Blog

How to Set Up a Mail Server with Modoboa on Ubuntu 20.04

Hitesh Jethva
by Atlantic.Net (198posts) under Tutorials, VPS Hosting
0 Comments

Modoboa is a free, open-source, complete mail server solution that comes with Postfix and Dovecot. It is written in Python and allows you to set up a fully functional mail server within a minute. You can create an unlimited number of mailboxes and domains from a web-based interface. It has Let’s Encrypt integration and also includes Amavis frontend to block spam and detect viruses in email.

If you are a beginner and don’t know how to set up a mail server, then Modoboa is the best option for you. In this post, we will learn how to set up a mail server with Modoboa on Ubuntu 20.04 server.

Prerequisites

  • A fresh Ubuntu 20.04 server on the Atlantic.Net Cloud Platform
  • A valid domain name pointed with your server
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Required Dependencies

Before starting, you will need to install Python and other required dependencies to your server. You can install all of them with the following command:

apt-get install python3-virtualenv python3-pip git curl gnupg2

Once all the packages are installed, set up an FQDN hostname with the following command:

hostnamectl set-hostname email.linuxbuz.com

Step 3 – Install and Configure Modoboa

First, download the latest version of Modoboa with the following command:

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

Once the download is completed, change the directory to the downloaded directory and check the configuration file with the following command:

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

You should see that the Modoboa configuration file is not found:

Welcome to Modoboa installer!

Configuration file installer.cfg not found, creating new one.

Next, create a configuration file for Modoboa with the following command:

nano installer.cfg

Change the following lines that match your domain name and email address:

[general]
hostname = email.%(domain)s

[certificate]
generate = true
type = letsencrypt

[letsencrypt]
email = [email protected]

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

Save and close the file, then start the Modoboa installation with the following command:

python3 ./run.py --interactive linuxbuz.com

Once the installation has been finished, you should get the following output:

Welcome to Modoboa installer!

Warning:
Before you start the installation, please make sure the following DNS records exist for domain 'linuxbuz.com':
  email IN A   
       IN MX  email.linuxbuz.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 amavis
Installing spamassassin
Installing razor
Installing clamav
Installing modoboa
Installing automx
Installing radicale
Installing uwsgi
Installing nginx
Installing opendkim
Installing postfix
Installing postwhite
Installing dovecot
Congratulations! You can enjoy Modoboa at https://email.linuxbuz.com (admin:password)

Next, you will need to edit the Nginx main configuration file and increase the hash_bucket size limit:

nano /etc/nginx/nginx.conf

Add the following line after http{

server_names_hash_bucket_size 64;

Save and close the file, then restart the Nginx service to apply the changes:

systemctl restart nginx

Step 4 – Access Modoboa Web UI

Now, open your web browser and access the Modoboa web UI using the URL https://email.linuxbuz.com. You will be redirected to the Modoboa login page:

Provide default admin username and password as admin / password and click on the Login button. You should see the Modoboa dashboard in the following page:

Conclusion

Congratulations! You have successfully installed the Modoboa mail server on Ubuntu 20.04. You can now add a mailbox from the Modaboa admin panel and start sending mail from the web UI using your VPS hosting account from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources