Set Up a private email server

by Felix Kinaro About 2 min reading time

Using a free Email service usually entails the risk of having your messages accessed by someone else. Mass surveillance by governments is also a major concern. You can take back control of your privacy by running your own mail server for a few dollars a month.

Requirements

For this tutorial, I'm going to use Mail-in-a-Box. It is relatively simple to install and configure, since it automates most of the steps.
A single instance can host emails for multiple domains and static websites. You can also save backups to Amazon S3.

Communication is secured using TLS certificates from Let's Encrypt, and are renewed automatically 14 days prior to the expiration date. Contact and calendaring functionalities are handled using Nextcloud.

Calendar

Process

  1. Go to vultr.com and create a new Ubuntu 18.04 server. The 25GB storage + 1GB RAM is sufficient. MiaB requires a fresh server for emails.

  2. Wait for the OS to be installed. Once complete, click on the newly-created virtual machine to see its properties and settings.
    Server

  3. Click on the settings option and set the reverse DNS to your domain name or subdomain.

  4. Go to your DNS provider's DNS management panel and create an A record pointing to your server's IP address.
    A record
    It may take up to 24 hours before the changes take effect.

  5. Log in using the web console or SSH. Set your hostname to be either your domain name or a subdomain

sudo hostnamectl set-hostname myhostname.com
  1. Copy and paste curl -s https://mailinabox.email/setup.sh | sudo bash to install Mail-in-a-Box. Follow the prompts.

Once installation is complete, go to yourdomain.tld/admin, where yourdomain.tld is the address of your server, and provision TLS certificates

Usage

To view emails, go to yourdomain.tld/mail and log in. You can also access your emails on an Android phone using either the Gmail app or K-9 Mail app.

On your desktop, Thunderbird is a free desktop client you can use.

Subscribe to receive weekly articles

Your data is handled by Buttondown.