🚀 Install Mailcow on a VPS — Mail Server in 30 Min

mailcow-dockerized end to end: DNS records, PTR, compose install, first mailbox and a Gmail deliverability test. Real commands for Ubuntu.

Mailcow is a full mail suite — Postfix (SMTP), Dovecot (IMAP), SpamAssassin, SOGo webmail, calendars and contacts — in one docker compose project with a panel. This guide covers DNS, install and the first deliverability test. Why self-host mail: mail server VPS.

1. Domain, PTR and DNS

Pick `mail.example.com`. Create an A record to your server and an MX record for `example.com` pointing to it (priority 10). Set the reverse DNS (PTR) of your IP to `mail.example.com` — in your server's control panel, under its IP. SPF, DKIM and DMARC you will generate in Mailcow after install — leave space for them now.

dig +short A mail.example.com
 dig +short MX example.com
# after install: dig +short TXT example.com | grep spf

2. Install mailcow-dockerized

apt update && apt install -y git ufw
git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
cp sample/mailcow.conf .
# set: MAILCOW_HOSTNAME=mail.example.com
ufw allow 25,80,110,143,465,587,993,995,4190/tcp && ufw allow OpenSSH && ufw --force enable
docker compose pull && docker compose up -d

The stack takes a few minutes to pull. The setup wizard at `https://mail.example.com` walks you through the DNS records Mailcow generates: SPF, DKIM keys and a DMARC policy — copy each into your DNS zone. Wait for propagation, then run the wizard's checks until they turn green.

3. First mailbox and the real test

In the panel: Configuration → Mailboxes — create `[email protected]`, set a password, open webmail at `/simplesaml` or via SOGo at `/SOGo`. Then send real mail to a Gmail and an Outlook address and inspect the headers: SPF, DKIM and DMARC must all show `pass`. Only after that tell anyone your new address.

Quick answers

Is outbound port 25 blocked?

On Buran servers it is not: a live check from our VPS to `mx.google.com` answers `220 ESMTP`, so your Postfix can talk to foreign mail servers. Inbound 25 you open yourself with ufw, as above.

How much disk does mail need?

Surprisingly little: a team of 15 with years of correspondence fits in 20–30 GB. Core VPS 4's 100 GB is enough for most; pick an NVMe tier if users keep large attachments, since Mailcow serves them over IMAP from the same disk.

Your domain, unlimited mailboxes, one flat bill. Get a mail server →

Related

View plansGuidesFAQ