Prerequisites
Important Decisions to Make
- Ensure you have full control of your domain to add records such as "A", "MX", etc. Verify that you can add records and that they are reflected on the internet.
- Select a domain name. For the email server, it is recommended to use a subdomain like mail.yourdomain.com. Ensure the domain is available and you have full control through your provider.
- Root access to the VM is required, as containers run on Docker. The VM must also be set up with other tools and configurations.
Hosting Requirements
-
Set the hostname of the machine to the correct domain name using the following command. (Note: You may need to review and update your
/etc/hostsfile as well.)hostnamectl set-hostname <mail.example.com> -
Ensure port 25 is accessible on the host where the email server will be hosted. Test it with the following command:
nc -4 -vz gmail-smtp-in.l.google.com 25Output:
Connection to gmail-smtp-in.l.google.com (172.217.194.26) 25 port [tcp/smtp] succeeded! -
Configure the 'A' record with the IPv4 address and the 'AAAA' record with the IPv6 address in your domain hosting platform. (Note: The process varies by provider.)
Ping should work from any external host to the email host.
ping <mail.example.com>Output:
Pinging mail.example.com [2202:1000:9000:700::15ef] with 32 bytes of data:
Reply from 2202:1000:9000:700::15ef: time=41ms
Reply from 2202:1000:9000:700::15ef: time=41ms -
Set reverse DNS for your VM at the provider hosting your VM. (Note: The process varies by provider.)
For more DNS-related requirements, visit the Mailcow Documentation.
Recommended VM Configuration
For optimal performance, including antivirus:
| Parameter | Minimum Configuration | Comment |
|---|---|---|
| RAM | 8 GB | This is for 5 to 10 users. For a larger user base, more RAM will be required based on the number of concurrent users accessing emails. |
| CPU | 2 vCPU | 4 vCPU recommended for smoother operations with a larger user base. |
| Space | 10 GB + configured user space based on number of users | If 3 GB per user and 20 users are planned, the minimum space should be around 70 GB. |
Required Settings and Packages on the VM
Install Basic System Packages
sudo apt install net-tools
Set the Correct Time Zone
dpkg-reconfigure tzdata
After this, ensure NTP is enabled and synchronized. Run the following command to check:
timedatectl status
Output:
Local time: Wed 2026-01-28 10:47:23 IST
Universal time: Wed 2026-01-28 05:17:23 UTC
RTC time: Wed 2026-01-28 05:17:23
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Network Settings for Optimal Performance
sysctl -w net.core.rmem_max=7500000
sysctl -w net.core.wmem_max=7500000
(Note: You may need to set this in /etc/sysctl.d to make it permanent on the host.)
Ensure Required Ports for Email Are Not Used or Blocked
If the following command returns anything, review and remove the processes before setting up the new email server.
ss -tlpn | grep -E -w '25|80|110|143|443|465|587|993|995|4190'
The above list covers the minimal settings required, for a more detailed and extensive list of prerequisites visit the MailCow Documentation.