how to setup a mail server with mailcow/docker on vps.
- User
how to setup a mail server with mailcow/docker on vps.
Assistant
how to setup a mail server with mailcow/docker on vps.
Setting up a mail server with Mailcow (a Docker-based mail server suite) on a VPS involves several steps. Below is a step-by-step guide to help you get started.
example.com) with proper DNS records.sudo apt update && sudo apt upgrade -y
sudo apt install -y docker.io docker-compose
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker # Apply changes without logout
Before installing Mailcow, ensure your domain has the following DNS records:
mail.example.com pointing to your VPS IP.mail.example.com.Example DNS records:
example.com. A YOUR_VPS_IP
mail.example.com. A YOUR_VPS_IP
example.com. MX 10 mail.example.com.
example.com. TXT "v=spf1 mx ~all"
Clone the Mailcow repository:
git clone https://github.com/mailcow/mailcow-dockerized.git
cd mailcow-dockerized
Run the setup script:
./generate_config.sh
mailcow.conf).mail.example.com).Start Mailcow:
docker-compose pull
docker-compose up -d
https://mail.example.com
(Replace mail.example.com with your domain.)adminmoohoo (change this immediately!)docker-compose logs -f
iptables):
sudo ufw allow 22/tcp # SSH
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw allow 25/tcp # SMTP
sudo ufw allow 143/tcp # IMAP
sudo ufw allow 465/tcp # SMTPS
sudo ufw allow 587/tcp # Submission
sudo ufw allow 993/tcp # IMAPS
sudo ufw enable
25, 80, 443, etc.docker-compose down and restart.You now have a fully functional mail server running on Mailcow! 🎉 For more details, check the official Mailcow documentation.
Would you like help with any specific part of the setup? 😊