← 返回導覽

手動構築郵驛

Manual Postfix & Dovecot Setup

部署流程

親手編織每一條訊息的通路。這條路雖然漫長,但能讓您完全掌控系統的每一個細節。

1 基礎安裝

安裝核心組件 Postfix (MTA) 與 Dovecot (IMAP/POP3)。

hostnamectl set-hostname mail.your-domain.com
apt update
apt install -y postfix postfix-mysql dovecot-core dovecot-imapd dovecot-pop3d

2 配置 Postfix

/etc/postfix/main.cf
myhostname = mail.your-domain.com
mydomain = your-domain.com
myorigin = $mydomain
inet_interfaces = all
home_mailbox = Maildir/
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

3 配置 Dovecot

/etc/dovecot/dovecot.conf
protocols = imap pop3
listen = *
mail_location = maildir:~/Maildir
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0660
    user = postfix
    group = postfix
  }
}

4 設定 SSL 與 重啟

獲取憑證並重啟服務。

apt install -y certbot
certbot certonly --standalone -d mail.your-domain.com

systemctl restart postfix dovecot