{"id":1743,"date":"2026-09-04T11:17:30","date_gmt":"2026-09-04T05:47:30","guid":{"rendered":"https:\/\/cpanelfree.com\/blog\/how-to-configure-mailcow-dockerized-email-server-ubuntu-vps\/"},"modified":"2026-09-04T11:21:52","modified_gmt":"2026-09-04T05:51:52","slug":"how-to-configure-mailcow-dockerized-email-server-ubuntu-vps","status":"publish","type":"post","link":"https:\/\/cpanelfree.com\/blog\/how-to-configure-mailcow-dockerized-email-server-ubuntu-vps\/","title":{"rendered":"How to Configure Mailcow: Dockerized Email Server on Ubuntu VPS (2026)"},"content":{"rendered":"<div style=\"background-color: #f8fafc;border-left: 4px solid #10b981;padding: 20px;border-radius: 6px;margin-bottom: 25px\">\n<p style=\"margin: 0;font-size: 16px;color: #1e293b\">\n        <strong>Quick Answer:<\/strong> <strong>Mailcow Dockerized<\/strong> is the gold standard open-source email server suite. To deploy it on an Ubuntu 24.04 VPS: <strong>1)<\/strong> Provision a 2 vCPU \/ 4GB RAM VPS with PTR reverse DNS configured, <strong>2)<\/strong> Install Docker and Docker Compose, <strong>3)<\/strong> Clone Mailcow repo from GitHub, <strong>4)<\/strong> Run <code>.\/generate_config.sh<\/code> to configure your hostname (<code>mail.yourdomain.com<\/code>), and <strong>5)<\/strong> Execute <code>docker compose up -d<\/code> to launch the complete mail stack with automated Let&#8217;s Encrypt SSL.\n    <\/p>\n<\/div>\n<h2>Minimum System Requirements for Mailcow<\/h2>\n<ul style=\"padding-left: 20px;line-height: 1.8\">\n<li><strong>Operating System:<\/strong> Ubuntu 24.04 \/ 22.04 LTS or Debian 12<\/li>\n<li><strong>RAM:<\/strong> 4GB minimum (or 2GB with <code>SKIP_CLAMAV=y<\/code> and <code>SKIP_SOLR=y<\/code> in <code>mailcow.conf<\/code>)<\/li>\n<li><strong>Disk:<\/strong> 30GB+ NVMe SSD storage<\/li>\n<li><strong>Network:<\/strong> Open outgoing Port 25, 465, 587, 993, 80, 443 with a clean IP address.<\/li>\n<\/ul>\n<h2>Step 1: Install Docker &amp; Docker Compose on Ubuntu<\/h2>\n<pre style=\"background-color: #1e293b;color: #38bdf8;padding: 14px;border-radius: 6px;font-size: 13px\">sudo apt update &amp;&amp; sudo apt install -y curl git apt-transport-https ca-certificates\ncurl -fsSL https:\/\/get.docker.com | sh\nsudo usermod -aG docker $USER<\/pre>\n<h2>Step 2: Clone Mailcow and Generate Configuration<\/h2>\n<pre style=\"background-color: #1e293b;color: #38bdf8;padding: 14px;border-radius: 6px;font-size: 13px\">cd \/opt\nsudo git clone https:\/\/github.com\/mailcow\/mailcow-dockerized\ncd mailcow-dockerized\nsudo .\/generate_config.sh<\/pre>\n<p>Enter your Fully Qualified Domain Name (e.g. <code>mail.yourdomain.com<\/code>) and select your timezone.<\/p>\n<h2>Step 3: Launch Mailcow Docker Containers<\/h2>\n<pre style=\"background-color: #1e293b;color: #38bdf8;padding: 14px;border-radius: 6px;font-size: 13px\">sudo docker compose pull\nsudo docker compose up -d<\/pre>\n<h2>Step 4: Configure DNS Records for 100% Deliverability<\/h2>\n<p>Add these DNS records in your domain control panel:<\/p>\n<ul style=\"padding-left: 20px;line-height: 1.8\">\n<li><code>A<\/code> record: <code>mail.yourdomain.com<\/code> -&gt; VPS Public IP<\/li>\n<li><code>MX<\/code> record: <code>@<\/code> -&gt; <code>mail.yourdomain.com<\/code> (Priority: 10)<\/li>\n<li><code>TXT<\/code> (SPF): <code>v=spf1 mx a:mail.yourdomain.com ~all<\/code><\/li>\n<li><code>TXT<\/code> (DMARC): <code>v=DMARC1; p=quarantine; pct=100;<\/code><\/li>\n<\/ul>\n<div style=\"background-color: #f8fafc;border: 1px solid #e2e8f0;border-left: 4px solid #0ea5e9;padding: 20px;border-radius: 8px;margin: 30px 0\">\n<h3 style=\"margin-top: 0;color: #0f172a;font-size: 18px;display: flex;align-items: center\">\n        <span style=\"margin-right: 8px\">\ud83d\udd17<\/span> Recommended Related Technical Guides:<br \/>\n    <\/h3>\n<ul style=\"margin: 10px 0 0 0;padding-left: 20px;line-height: 1.8\">\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/self-hosted-mail-server-vs-managed-email-comparison\/\" style=\"color: #0284c7;text-decoration: none;font-weight: 600\">Self-Hosted Mail Server vs Managed Email<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-setup-spf-dkim-dmarc-records-email-deliverability\/\" style=\"color: #0284c7;text-decoration: none;font-weight: 600\">How to Set Up SPF, DKIM &amp; DMARC Records<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-setup-fresh-ubuntu-24-04-vps-scratch\/\" style=\"color: #0284c7;text-decoration: none;font-weight: 600\">How to Set Up a Fresh Ubuntu 24.04 VPS<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"color: #0284c7;text-decoration: none;font-weight: 600\">Explore $0 Free cPanel Web Hosting Plans<\/a><\/li>\n<\/ul>\n<\/div>\n<h2>Fine-Tuning Mailcow Docker Resource Consumption<\/h2>\n<p>By default, ClamAV antivirus and Solr search indexing consume over 2.5GB of RAM. On a resource-constrained 2GB VPS, optimize <code>mailcow.conf<\/code> before booting:<\/p>\n<pre style=\"background-color: #1e293b;color: #38bdf8;padding: 14px;border-radius: 6px;font-size: 13px\"># Disable heavy memory daemons in mailcow.conf\nSKIP_CLAMAV=y\nSKIP_SOLR=y<\/pre>\n<p>This reduces Mailcow&#8217;s idle memory consumption down to <strong>under 750MB<\/strong>, leaving sufficient resources for Postfix, Dovecot, and Nginx reverse proxy containers.<\/p>\n<h2>Backing Up Mailcow Docker Volumes via Automated Script<\/h2>\n<pre style=\"background-color: #1e293b;color: #38bdf8;padding: 14px;border-radius: 6px;font-size: 13px\"># Execute automated Mailcow backup script\nBACKUP_LOCATION=\/var\/backups\/mailcow .\/helper-scripts\/backup_and_restore.sh backup all<\/pre>\n<h2>Essential Post-Installation Hardening for Mailcow Dockerized<\/h2>\n<ol style=\"padding-left: 20px;line-height: 1.8\">\n<li><strong>Enable Two-Factor Authentication (2FA):<\/strong> In the Mailcow admin dashboard, require TOTP two-factor authentication for all administrative accounts.<\/li>\n<li><strong>Configure Automated Backup Cron:<\/strong> Set up a daily cron job running <code>backup_and_restore.sh<\/code> to push encrypted volume archives to an offsite S3 or SFTP server.<\/li>\n<li><strong>Fine-Tune Rspamd Greylisting:<\/strong> Configure Rspamd greylisting thresholds to delay unknown connecting mail servers by 5 minutes, eliminating 90% of automated botnet spam blasts.<\/li>\n<\/ol>\n<div style=\"border-bottom: 1px solid #e2e8f0;padding: 12px 0\">\n<h4 style=\"margin: 0 0 8px 0;color: #1e293b\">How does Mailcow handle Let&#8217;s Encrypt SSL renewals?<\/h4>\n<p style=\"margin: 0;color: #475569;font-size: 14px\">Mailcow includes an integrated ACME container (<code>acme-mailcow<\/code>) that automatically checks domain DNS records, requests Let&#8217;s Encrypt multi-domain certificates, and reloads Postfix\/Dovecot every 60 days without downtime.<\/p>\n<\/div>\n<div style=\"background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);border: 1px solid #334155;border-radius: 12px;padding: 25px;margin: 30px 0;text-align: center\">\n<h3 style=\"color: #38bdf8;margin-top: 0;font-size: 20px\">Deploy Scalable Cloud Servers on CpanelFree<\/h3>\n<p style=\"color: #94a3b8;font-size: 14px;line-height: 1.6;max-width: 600px;margin: 0 auto 15px\">\n        Deploy high-speed NVMe cloud instances with root SSH access, dedicated IP options, and 24\/7 uptime monitoring on <strong>CpanelFree<\/strong>.\n    <\/p>\n<p>    <a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"display: inline-block;background-color: #10b981;color: #ffffff;padding: 10px 22px;border-radius: 6px;text-decoration: none;font-weight: bold;font-size: 14px\">Explore Cloud Servers<\/a>\n<\/div>\n<h2>Frequently Asked Questions<\/h2>\n<div style=\"border-bottom: 1px solid #e2e8f0;padding: 12px 0\">\n<h4 style=\"margin: 0 0 8px 0;color: #1e293b\">How do I access the Mailcow admin UI?<\/h4>\n<p style=\"margin: 0;color: #475569;font-size: 14px\">Open your web browser and go to <code>https:\/\/mail.yourdomain.com<\/code>. Log in using default credentials: Username <code>admin<\/code> and Password <code>moohoo<\/code> (remember to change it immediately!).<\/p>\n<\/div>\n<h2>Configuring Mailcow Multi-Domain Relaying and Transport Maps<\/h2>\n<p>If your VPS hosting provider blocks outbound port 25, Mailcow features a built-in <strong>Routing \/ Transports<\/strong> menu in its admin UI. You can enter an external SMTP relay host (such as <code>smtp-relay.brevo.com:587<\/code>) with authenticated credentials, routing all outgoing mail through the relay while storing incoming IMAP mailboxes locally.<\/p>\n<div style=\"background-color: #f1f5f9;padding: 15px;border-radius: 8px;margin: 20px 0\">\n<h4 style=\"margin-top: 0;color: #1e293b\">Pro Sysadmin Tip: Upgrading Mailcow Dockerized in 1-Click<\/h4>\n<p style=\"margin: 0;color: #475569;font-size: 14px\">To update your entire containerized mail stack, navigate to <code>\/opt\/mailcow-dockerized<\/code> and execute <code>.\/update.sh<\/code>. The script automatically pulls updated container images and applies database schema migrations safely.<\/p>\n<\/div>\n<p>Deploying Mailcow Dockerized delivers an enterprise-grade private email hosting infrastructure with modern webmail, automated spam filtering, and complete data privacy.<\/p>\n<h2>Automating Mailcow SSL Renewal and Certbot Monitoring<\/h2>\n<p>Mailcow&#8217;s integrated ACME daemon automatically requests and renews multi-domain Let&#8217;s Encrypt certificates every 60 days. You can monitor certificate status and force immediate renewal in the Mailcow admin UI under <em>Configuration &gt; SSL Certificates<\/em>.<\/p>\n<div style=\"border-bottom: 1px solid #e2e8f0;padding: 12px 0\">\n<h4 style=\"margin: 0 0 8px 0;color: #1e293b\">How many mailboxes can a 4GB RAM Mailcow server host?<\/h4>\n<p style=\"margin: 0;color: #475569;font-size: 14px\">A standard 2 vCPU \/ 4GB RAM Cloud VPS running Mailcow can comfortably support over 100 active business mailboxes with full spam filtering and groupware synchronization.<\/p>\n<\/div>\n<p>Additionally, Mailcow includes native DKIM key generation in its web interface, automatically creating 2048-bit DNS TXT records for all hosted domains.<\/p>\n<p>With automated Let&#8217;s Encrypt renewals, Rspamd anti-spam, and isolated Docker microservices, Mailcow offers the most robust open-source mail server platform available for Linux sysadmins.<\/p>\n<p>Regularly maintaining your Mailcow Docker containers and monitoring mail queue status via <code>docker compose exec postfix-mailcow mailq<\/code> guarantees high deliverability and uninterrupted email service for all your custom domains.<\/p>\n<p>By implementing proper DNS records, TLS certificates, and resource monitoring, your self-hosted Mailcow server will deliver enterprise-grade performance and reliability across all mail domains.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quick Answer: Mailcow Dockerized is the gold standard open-source email server suite. To deploy it on an Ubuntu 24.04 VPS: 1) Provision a 2 vCPU \/ 4GB RAM VPS with PTR reverse DNS configured, 2) Install Docker and Docker Compose, 3) Clone Mailcow repo from GitHub, 4) Run .\/generate_config.sh to configure your hostname (mail.yourdomain.com), and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1742,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"class_list":["post-1743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/comments?post=1743"}],"version-history":[{"count":7,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1743\/revisions"}],"predecessor-version":[{"id":1801,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1743\/revisions\/1801"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media\/1742"}],"wp:attachment":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media?parent=1743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/categories?post=1743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/tags?post=1743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}