Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Mailcow on a VPS (Complete Guide)

A complete step-by-step guide to self-hosting Mailcow on a VPS in 2026, covering installation, configuration, securing Mailcow, and the specs you need.

How to Self-Host Mailcow on a VPS (Complete Guide)

Mailcow is a powerful open-source email server suite based on Docker, which offers services like email hosting, calendar, and collaboration tools. Self-hosting Mailcow can give you full control over your email environment, and using a Virtual Private Server (VPS) is a practical solution for running Mailcow efficiently. In this guide, weโ€™ll take you through the steps to install and configure Mailcow on a VPS.

Prerequisites

Before you start, ensure you have the following ready:

Recommended VPS providers include:

ProviderStarting PriceFeatures
Contabo VPS5.99 EUR/moSSD, DDoS protection
Hetzner Cloud4.15 EUR/moFlexible pricing, pay-as-you-go
DigitalOcean6 USD/moUser-friendly interface
Vultr6 USD/moGlobal data centers
Linode (Akamai)5 USD/moFast performance

Choose a VPS provider that meets your budget and performance requirements. You can check out our full VPS comparison for more options.

Step 1: Set Up Your VPS

  1. Create your VPS instance using your chosen provider and log in to your server via SSH:

    ssh root@your_server_ip
  2. Update your system to ensure all existing packages are up-to-date:

    apt update && apt upgrade -y
  3. Install required dependencies:

    apt install curl git docker-compose -y

Step 2: Domain Configuration

  1. Point your domainโ€™s DNS records to your VPS IP address. Set up an A record for the base domain and subdomains that you will use for Mailcow (e.g., mail.yourdomain.com).

  2. Allow some time for DNS propagation.

Step 3: Install Mailcow

  1. Download the Mailcow installation files:

    curl -L https://github.com/mailcow/mailcow-dockerized/archive/refs/heads/master.zip -o mailcow.zip
    unzip mailcow.zip
    cd mailcow-dockerized-master
  2. Copy the configuration file:

    cp mailcow.conf.example mailcow.conf
  3. Edit the configuration by specifying your domain:

    nano mailcow.conf
    • Set MAILCOW_HOSTNAME to your domain name, e.g., mail.yourdomain.com.
  4. Start Mailcow with Docker Compose:

    docker-compose pull
    docker-compose up -d

Step 4: Configuration via the Web Interface

  1. Access the Mailcow web interface by navigating to https://mail.yourdomain.com.

  2. The default login credentials are:

    • Username: admin
    • Password: moo@cow
  3. Configure your email aliases, domains, and other settings according to your requirements.

Step 5: Set Up DKIM and SPF Records

To enhance email deliverability, set up DKIM and SPF records:

  1. Create DKIM records by following the Mailcow interfaceโ€™s instructions.
  2. Add SPF records to your DNS settings to specify which mail servers are permitted to send email on behalf of your domain.

Example SPF record:

v=spf1 a mx ip4:YOUR_VPS_IP -all

Step 6: Testing Your Setup

  1. Send a test email to verify deliverability.
  2. Check your spam folder to ensure the message didnโ€™t get flagged.

FAQ

How do I update Mailcow once itโ€™s installed?

Updating Mailcow is straightforward. First, navigate to the Mailcow installation directory, then use the following commands:

docker-compose pull
docker-compose up -d

This will download the latest Docker images and restart the services with the updated configurations. It is also wise to check the Mailcow documentation for specific version update notes.

What if I encounter SSL certificate issues?

If you are facing SSL certificate problems, consider using Letโ€™s Encrypt for free SSL certificates. Mailcow has built-in support for Letโ€™s Encrypt. Ensure that your DNS is properly configured before using the Letโ€™s Encrypt feature in the Mailcow web interface. For more advanced configurations or troubleshooting, refer to various discussions in the r/selfhosted subreddit or on the Mailcow forums.

Can I run Mailcow on a low-spec VPS?

While Mailcow can technically run on a low-spec VPS, it is not recommended. Mailcowโ€™s performance can be affected by limited RAM and CPU resources, especially if you are planning to handle multiple email accounts or if you run additional services alongside it. For a smoother experience, a VPS with at least 2-4 GB of RAM is ideal.

Conclusion

Self-hosting Mailcow on a VPS provides you with full control over your email systems. By following this step-by-step guide, you can successfully install and configure Mailcow to fit your personal or business needs. Remember to monitor your systemโ€™s performance and adjust your server specs if necessary. Happy self-hosting!