Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung | |||
lpi2:postfix [2017/04/02 19:44] |
lpi2:postfix [2022/12/21 14:52] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Minimal-Konfiguration ====== | ||
+ | Vorraussetzung für Mail ist eine korrekte [[ dns| client- ]] und [[ bind | serverseitige ]] DNS Konfiguration, inkl. ''hostname -f'' | ||
+ | ===== Benötigte Pakete ===== | ||
+ | SuSE, Debian, RedHat: | ||
+ | postfix | ||
+ | |||
+ | ==== Debian ==== | ||
+ | exim Konfigurationsdateien direkt bei der Installation von Postfix entfernen: | ||
+ | |||
+ | apt --purge install postfix | ||
+ | |||
+ | ((exim Konfigurationsdateien nach der Installation von Postfix entfernen: | ||
+ | dpkg-query -W -f='${Package}\n' | grep exim | xargs dpkg --purge | ||
+ | )) | ||
+ | ==== SuSE ==== | ||
+ | SuSE hat seine eigenen Vorstellungen, wie man Postfix konfiguriert. Wenn man die Konfiguration aber nicht ''yast'' überlassen möchte, muß man die Datei ''/etc/sysconfig/mail'' anpassen: | ||
+ | <file> | ||
+ | MAIL_CREATE_CONFIG="no" | ||
+ | </file> | ||
+ | |||
+ | ==== RedHat ==== | ||
+ | Für RedHat wird auch das Paket ''system-switch-mail'' empfohlen | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | Der Großteil der Konfiguration spielt sich in den Dateien ''/etc/postfix/main.cf'' und ''/etc/postfix/master.cf'' ab. Die Datei ''/etc/postfix/main.cf'' kann man mit einem Editor oder über den Befehl ''postconf'' bearbeiten. | ||
+ | |||
+ | |||
+ | |||
+ | ==== Postfix ==== | ||
+ | In der Folge werden sinnvolle Werte für ''myhostname'' und ''mydomain'' gesetzt. Und die Parameter ''mydestination'', ''inet_interfaces'', ''mynetworks'', ''smtpd_recipient_restrictions'', ''smtpd_relay_restrictions'', ''default_transport'' und ''relay_transport'' werden auf ihre default-Werte gesetzt: | ||
+ | <code bash> | ||
+ | postconf -e "myhostname = $(hostname -f)" | ||
+ | postconf -e "mydomain = $(hostname -d)" | ||
+ | |||
+ | for PARAMETER in mydestination inet_interfaces mynetworks smtpd_recipient_restrictions smtpd_relay_restrictions default_transport relay_transport; | ||
+ | do | ||
+ | postconf -# $PARAMETER; | ||
+ | done; | ||
+ | </code> | ||
+ | |||
+ | service postfix restart | ||
+ | |||
+ | |||
+ | |||
+ | ===== Testen ===== | ||
+ | lsof -i :25 | ||
+ | |||
+ | netcat -v localhost 25 | ||
+ | HELO localhost | ||
+ | MAIL FROM: root@localhost | ||
+ | RCPT TO: nutzer15@localhost | ||
+ | DATA | ||
+ | From: root@localhost | ||
+ | To: nutzer15@localhost | ||
+ | Subject: testmail | ||
+ | | ||
+ | Dies ist eine Testmail | ||
+ | . | ||
+ | quit | ||
+ | |||
+ | ====== Destination ====== | ||
+ | postconf -d mydestination | ||
+ | postconf mydomain | ||
+ | postconf mydestination='$myhostname, $mydomain, localhost.$mydomain, localhost' | ||
+ | systemctl restart postfix.service | ||
+ | |||
+ | ====== Links ====== | ||
+ | * http://www.postfix.org |