How to Setup an Email Server with Mail-in-a-Box on Ubuntu

How to Setup an Email Server with Mail-in-a-Box on Ubuntu

Today we will show you how to setup Mail-in-a-Box on an Ubuntu 14.04 VPS. Mail-in-a-Box is a free and open source application that makes it easy to turn your Ubuntu 14.04 server into a complete, full-stack email solution for multiple domains. Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box. Each Mail-in-a-Box provides webmail and an IMAP/SMTP server for use with mobile devices and desktop mail software. It also includes contacts and calendar synchronization. The installation process should take about 10-15 minutes if you follow the very easy steps described below.

1. Requirements

You must have SSH access.
You must have a server with at least 768 MB of RAM, but 1 GB or more memory is recommended.

2. Instructions

Login to your VPS via SSH

## ssh root@vps

Update the system and install necessary packages

## apt-get update && sudo apt-get -y upgrade
## apt-get install git nano curl

Set the Hostname & FQDN

## hostname -f

should display something like If it is not already set, you’ll need to modify the /etc/hosts and /etc/hostname files to match.

Add your FQDN to the /etc/hosts file
Add your FQDN to the /etc/hostname file and run

## service hostname restart

3. Install Mail-in-a-Box

## cd
## curl -s | sudo bash

The script will prompt you with the introductory message in the following image. Press the Enter button on the keyboard.


First question, we will be asked to enter our email address that we’ll use to login to our Mail-in-a-box control panel and use as the default email address for our server. We can add other email addresses later. Here, in this tutorial, we will go with . Once it is done, we will continue by selecting OK in the menu.


Next, we will be asked to enter the hostname for our mail server. As we have already set in the above step, we should be prompted with as the default hostname. So, we will simply leave it as is and continue further.


Once it is done, we will be asked to select our country where we live. After we have selected our country, we will need to hit enter to proceed ahead. This will prompt another box asking us to enter the city or region corresponding with our timezone. Doing this will exit the box and continue the installation process.


At some point, you will get this prompt:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99

Okay. I'm about to set up for you. This account will also have access to the box's control panel.


Specify a password for the default email account, which will also be the default web interface admin account. Be sure to use a strong password, keeping your mail server secure is of the utmost importance. You can generate a strong password through the command line.

That’s it. You are pretty much done. All that is left is to point your domains’ DNS to Mail-in-a-Box and you will have a fully functional Mail server, webmail, calendar, web server and contacts. And, on top of it all, it uses the latest encryption methods to make your mail server as secure as possible.


Please log in to the control panel for further instructions at:


To access the Webmail you will need to navigate your web browser to:

This will load the login page of Roundcube webmail client where we will need to enter the email address and its password in order to login. Then, we can successfully access, send and manage our emails easily from anywhere.

Of course, you don’t have to Setup an Email Server with Mail-in-a-Box on Ubuntu,  if you use one of our Email Hosting services, in which case you can simply ask our expert Linux admins to install Mail-in-a-Box for you. They are available 24×7 and will take care of your request immediately. You may want to read updates from this post How to Install a Mail Server with PostfixAdmin on Ubuntu 20.04.

PS. If you liked this post, on How to Setup an Email Server with Mail-in-a-Box on Ubuntu,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment