# TODO: Add Catchy Tagline

How to Install Your Own Email Server

In an attempt to de-Google my life, the low hanging fruit is to not allow Google to have access to one of the most intimate digital moments of my life... email. I constantly heard and read endless posts on /r/selfhosted about how difficult and unreliable hosting email services are, but instead of taking some internet strangers word for it, let's give it a shot!


I was going back and forth between Mail-in-a-Box and Mailcow and eventually settled on MiaB due to it's lower RAM requirements (AKA lower monthly hosting charges).

Hosting Services

After comparing many different hosting providers, I was left with the following providers that offer reasonably-priced services that also include available credits.

Linode ⭐️

For $5 per month, you can grab a virtual machine that offers 1 GB RAM with 25 GB SSD Storage, which works perfectly for our needs. I ended up going with Linode due to the initial credits that are offered would allow for the first 4 months of the email hosting being free.

Vultr offers the same 1 GB RAM/25 GB SSD Storage option at $5/month. They offer a credit of $50 when you sign up, but that credit is only valid for the first month of service, which would be good for a deployed service that needs more resources and not so much for our email hosting needs. Regardless, I will be using Vultr in the future for some of my projects.

Domain Services

NameSilo offers cheap domain names with privacy built in and is my go-to registrar for mostly all sites.

Server Setup

We are going to grab the required base image from Linode:

From the Linode account page, click Linodes:
  1. Distribution: Ubuntu 18.04 LTS
  2. Region: Select region that is closest to your (or your VPN if always used). They offer a speedtest to choose the fastest one, but results can be skewed if you're on VPN.
  3. Linode Plan: Nanode 1GB
  4. Linode Label: us-${optional-region}-mail
  5. Add Tags: mail-in-a-box
  6. Root Password: Get a password manager and make it strong! (BitWarden is opensource with a self-hosted option and the dev is active in /r/bitwarden. hint, hint.)
  7. Add SSH Key: On MacOS, open your favorite terminal app and copy your SSH key with: 
    • pbcopy < ~/.ssh/ 
    • If you need additional SSH key help, GitHub offers a plethora of resources dedicated to just that. 
  8. Optional Add-ons: Private IP
  9. Click Create
  10. Navigate to the Networking tab within your account 
    1. For both IPv4 and IPv6, Click the ellipsis
    2. Select Edit RDNS
    3. Set your domain name ( as the reverse DNS and save 

Glue Records

The association between your domain name and IP address is . . . complicated. The domain name system (DNS) is a global, distributed network of machines that turn domain names into IP addresses. Your registrar and your box play a role in the domain name system.

Head on over to our registrar, NameSilo, and let's update those records. Within your domain console, look for the panel NameServers and click on the View/Manage Registered NameServers. We need two different host names that will have subdomains of ns1 and ns2. The following steps will be duplicated for both ns1 AND ns2.

  1. Click Register New NameServer
  2. Host: ns1 + your registered domain name
  3. Host IP 1: Your Linode public IP address
    1. Repeat steps 1-3 for ns2
  4. Go back to your Domain Console and update your NameServers to the ns1/ns2 names.

Mail-in-a-Box Installation

We're nearing the end and it's time for the most important part... the actual email service. Head back over to your Linode instance and grab your SSH from the Networking tab. It's Terminal Time!

# ssh into the box
ssh [email protected]
# install the service
curl -s | sudo -E bash

Follow the prompts for your admin MiaB username and domain. I removed the box.* subdomain since my domain will only be used for email. Once the installer completes, your can access your control panel with the username you provided in the setup script.

The setup script failed once or twice for me when attempting to pull some JS assets. Running `sudo mailinabox` can be ran multiple times and helped fixed the initial failures.

Head over the the admin portal providing to you in the script output. Further admin and system checks are available via the Mail-in-a-Box setup page.

If you run into any issues, please check Linode's guide that helps to get up and running quickly on their nodes.

Happy Emailing!
Self Host Email Server Privacy