Postfix on AlmaLinux 9

Install and secure Postfix on AlmaLinux 9 with a controlled relay policy and test workflow.

Cornerstone guideUpdated 2026-07-19By Ilirjan Trushilla

Install packages

dnf install -y postfix s-nail swaks
systemctl enable --now postfix

Set identity

postconf -e "myhostname = mail.example.com"
postconf -e "mydomain = example.com"
postconf -e "myorigin = $mydomain"

Relay safety

Never make Postfix an open relay. Define trusted networks narrowly and require authentication for remote submission.

postconf -e "mynetworks = 127.0.0.0/8, [::1]/128"
postconf -e "smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination"

Validate and reload

postfix check
postconf -n
systemctl reload postfix
ss -lntp | grep master

Test

swaks --server 127.0.0.1 --from [email protected] --to [email protected]

Logs

On AlmaLinux, inspect journald and the configured mail log destination. Confirm the actual logging path before relying on copied troubleshooting commands.

Production checklist

  • Hostname and PTR aligned
  • No open relay
  • TLS configured
  • Submission authenticated
  • Queue monitored
  • DKIM signing integrated
  • Abuse and bounce processes documented
Search Trushilla Documentation