In this tutorial, we will show you how to install and configure Mail-in-a-Box on Ubuntu 16.04 LTS. For those of you who didn’t know, Mailinabox is free and open-source software that deploys a complete full-stack email solution with a well-managed server control panel in a few simple minutes. Deploying our own well-managed email server is pretty easy with Mailinabox now. It is designed to handle SMTP, IMAP/POP, spam filtering, and webmail, and since the server itself is handling our DNS, we’ll get an off-the-shelf DNS solution optimized for mail. Mailbox has the ability to host multiple domains of email and provides webmail, contacts, calendar synchronization, and IMAP/SMTP server setting so that we can access our emails with mobile devices and desktop email clients.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation Mail-in-a-Box on a Ubuntu 16.04 (Xenial Xerus) server.
- A server running one of the following operating systems: Ubuntu 16.04 (Xenial Xerus).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Mail-in-a-Box on Ubuntu 16.04 LTS
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt-get commands in the terminal.
sudo apt-get update sudo apt-get upgrade sudo apt-get install git nano curl
Step 2. Setting Hostname.
First of all, we’ll need to set up a hostname for our machine running Ubuntu 16.04 LTS. Officially, the hostname of our machine should be set to box.example.com so that our installation goes easy:
Then, we’ll need to append the file to the following line:
Step 3. Adding Hosts.
Now, we’ll edit
/etc/hosts file so that we can associate our hostname with the server’s IP address where we are going to set up a mailbox. To do so, we’ll need to execute the following command:
Then, we’ll need to append the file with the following lines:
127.0.0.1 localhost.localdomain localhost server_ip_address box.idroot.us box
Step 4. Installing Mail-in-a-Box.
Run the following command to install Mail-in-a-Box:
curl -s https://mailinabox.email/bootstrap.sh | sudo bash
The script will prompt you with the introductory message in the following image. Press the Enter button on the keyboard:
The first question, we will be asked to enter the email address that we’ll use to login to our Mail-in-a-box control panel and use it as the default email address for our server. We can add other email addresses later. Once it is done, we will continue by selecting OK on 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 box.rosehosting.com 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 the 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:
Okay. I'm about to set up email@example.com for you. This account will also have access to the box's control panel. password:
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.
Step 5. Accessing Mail-in-a-Box Panel.
Mail-in-a-Box will be available on HTTP port 80 by default. Open your favorite browser and navigate to
http://server-ip/admin. If you are using a firewall, please open port 80 to enable access to the control panel.
Congratulations! You have successfully installed Mail-in-a-Box. Thanks for using this tutorial for installing Mail-in-a-Box on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you check the official Mail-in-a-Box website.