管理 Ubuntu 邮件服务器涉及安装、配置、运维、安全、监控等多个方面。下面我按从入门到可生产使用的顺序,系统性地讲一遍。
在 Ubuntu 上常见组合有:
如果你是第一次管理邮件服务器,强烈建议用 iRedMail。
sudo apt update
sudo hostnamectl set-hostname mail.example.com
配置 DNS:
mail.example.comexample.com → mail.example.comsudo apt install postfix
选择:
example.com测试:
systemctl status postfix
sudo apt install dovecot-core dovecot-imapd dovecot-pop3d
启用服务:
systemctl enable --now dovecot
adduser user1
apt install certbot
certbot certonly --webroot -w /var/www/html -d mail.example.com
Postfix:
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem
smtpd_tls_security_level = may
Dovecot:
ssl = required
ssl_cert = </etc/letsencrypt/live/mail.example.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.example.com/privkey.pem
apt install opendkim opendkim-tools fail2ban
postqueue -p
postsuper -d ALL
/var/log/mail.log
journalctl -u postfix
mailq
postconf -n
dovecot -n
/etc/postfix/etc/dovecot✅ 不想折腾:
iRedMail(Ubuntu + 一键脚本)
✅ 想深入学习:
Postfix + Dovecot + PostfixAdmin
✅ 企业级:
Mailcow Docker
如果你愿意,可以告诉我:
我可以直接给你一步一步可执行的配置方案。