Skip to content

Self-hosted e-mail with Mailcow and debian

Foreword

This document can be seen as a todo-list for setting up a Debian server from scratch, for self-hosted e-mail.

For the most part, content related to self-hosted e-mail is taken from the Mailcow documentation.

This uses Docker on top of a Debian 9 system. I made it work on a x86_64 Debian 9 VPS, but couldn't manage to do so on an ARM-based one, which means that Raspberry Pis may or may not work.

To test your configuration at the end of this guide, you may use Mail-tester.

Global checklist

  • Install/order the base machine
  • Apt update/upgrade everything
  • Make sure you have the bridge-utils package installed
  • Install docker (not through official repositories) following this doc.
  • Check that no process is using a port required by Mailcow
  • Check that the system's timezone's okay
  • Domain name preparation
    • Name and FQDN choices
    • Base DNS migration
  • Follow the install guide for Mailcow
  • Create an unprivileged user
  • Remove root login authorization over SSH
  • Configure Fail2ban
  • Disable ping answer and such
  • Connect the hosting server to my VPN for monitoring
  • Install monitoring data extractor
  • Configure the monitoring master server to monitor this server too

Optional operations

  • Add a command-line SMTP utility to send emails (a good tool being sendmail)