Setup Email Server From Scratch Debian #2

 Intro -> 01 Server Setup

We believe in data independence, and support others who want data independence.
Debian Email From Scratch version 2 finished 2025-07-30.

We are still adding to it but it all works!

My two favorite operating systems for servers are FreeBSD and Debian. In 1994 I switched from Linux to FreeBSD and after more development found I was unable to migrate my main project back to Linux (at that time). Fast forward 30 years. My website runs on FreeBSD with an Ubuntu bhyve virtual machine running Zimbra Mail. Forwarding ports with ipfw (kernel level firewall) to the internal VM is tricky, and a couple times a year the Zimbra VM stops working and needs to be rebooted. It would be better to install and run the email stack natively on a separate Debian server.

This tutorial is based on Linuxbabe - Build Email Server From Scratch on Debian. This is Debian Email From Scratch version 2 using Debian 12.11. For this tutorial we'll use packages installed in default locations to simplify maintenance, updates and upgrades. To install Roundcube it is better to use git sources rather than packages (calendar plugin doens't work with package version of Roundcube), instructions for both methods, page 7 - git / 8 apt (pkg).

File edits or contents start with and end with '# ---' sometimes with an additional message like '# --- additional message ---'. Do not include these lines in the files. Also in some place we put a line with three dots, do not include these. The 3 dots indicate that the files has more lines between and skip farther down in the files and continue editing.


01 Server Setup
02 LAMP Install
03 Postfix SMTPD
04 Dovecot IMAP
05 PostfixAdmin
06 SPF DKIM DMARC
07 RoundCube WebMail
08 RoundCube WebMail PKG
09 Virtual Domains
10 Blocking Spam
11 SpamAssassin
12 Amavis Clam AntiVirus
13 Reducing Server Load With Postscreen
25 IMAPSYNC
80 Bind DNS

 Intro -> 01 Server Setup