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
- A domain name, or a subdomain you control.
- A cloud hosted virtual private server(Use this mutually beneficial link to get started on vultr.com). A hosted VPS is preferred since the IP address will not be reassigned, for instance when disconnected.
- Some free time
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.
Process
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.
Wait for the OS to be installed. Once complete, click on the newly-created virtual machine to see its properties and settings.
Click on the settings option and set the reverse DNS to your domain name or subdomain.
Go to your DNS provider's DNS management panel and create an A record pointing to your server's IP address.
It may take up to 24 hours before the changes take effect.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
- 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.