Postfix unter Debian einrichten

Aus Thomas-Krenn-Wiki
Zur Navigation springen Zur Suche springen

Postfix ist ein weit verbreiteter Mailserver, genauer gesagt ein MTA (Mail Transfer Agent). In diesem Artikel beschreiben wir wie Sie Postfix unter Debian Lenny 5.0 installieren. Im Beispiel verwenden wir einen Testserver (lists.wefi.net). Ersetzen Sie diesen Namen mit dem Namen Ihres Servers.

Paket installieren

Auf der Kommandozeile starten Sie die Postfix-Installation so:

apt-get install postfix

Debian gibt darauf einen Hinweis, dass Exim entfernt wird und fragt, ob Sie mit der Installation fortfahren möchten:

lists:~# apt-get install postfix
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin libsasl2-modules
  resolvconf postfix-cdb ufw
The following packages will be REMOVED:
  exim4 exim4-base exim4-config exim4-daemon-light
The following NEW packages will be installed:
  postfix
0 upgraded, 1 newly installed, 4 to remove and 0 not upgraded.
Need to get 1224kB of archives.
After this operation, 1008kB disk space will be freed.
Do you want to continue [Y/n]? y
Get:1 http://http.at.debian.org lenny/main postfix 2.5.5-1.1 [1224kB]
Fetched 1224kB in 0s (6060kB/s)
Preconfiguring packages ...

Paket Konfiguration

Postfix Configuration: General type of mail configuration

Im ersten Konfigurationsschritt wählen wir in diesem Beispiel Internet Site. Je nach Ihren individuellen Anforderungen wählen Sie hier den entsprechenden Eintrag.

Package configuration
         ┌───────────────────────────┤ Postfix Configuration ├───────────────────────────┐
         │ Please select the mail server configuration type that best meets your needs.  │ 
         │                                                                               │ 
         │  No configuration:                                                            │ 
         │   Should be chosen to leave the current configuration unchanged.              │ 
         │  Internet site:                                                               │ 
         │   Mail is sent and received directly using SMTP.                              │ 
         │  Internet with smarthost:                                                     │ 
         │   Mail is received directly using SMTP or by running a utility such           │ 
         │   as fetchmail. Outgoing mail is sent using a smarthost.                      │ 
         │  Satellite system:                                                            │ 
         │   All mail is sent to another machine, called a 'smarthost', for delivery.    │ 
         │  Local only:                                                                  │ 
         │   The only delivered mail is the mail for local users. There is no network.   │ 
         │                                                                               │ 
         │ General type of mail configuration:                                           │ 
         │                                                                               │ 
         │                            No configuration                                   │ 
         │                            Internet Site                                      │ 
         │                            Internet with smarthost                            │ 
         │                            Satellite system                                   │ 
         │                            Local only                                         │ 
         │                                                                               │ 
         │                                                                               │ 
         │                     <Ok>                         <Cancel>                     │ 
         │                                                                               │ 
         └───────────────────────────────────────────────────────────────────────────────┘ 
Postfix Configuration: System mail name

Im zweiten Schritt geben wir den Mail Namen des Servers an. Da es sich beim Beispiel um einen Mailinglisten-Server handelt, steht hier lists.wefi.net (die Emailadressen lautet dann z.B. mailingliste@lists.wefi.net):

Package configuration

  ┌──────────────────────────────────┤ Postfix Configuration ├───────────────────────────────────┐
  │ The "mail name" is the domain name used to "qualify" _ALL_ mail addresses without a domain   │ 
  │ name. This includes mail to and from <root>: please do not make your machine send out mail   │ 
  │ from root@example.org unless root@example.org has told you to.                               │ 
  │                                                                                              │ 
  │ This name will also be used by other programs. It should be the single, fully qualified      │ 
  │ domain name (FQDN).                                                                          │ 
  │                                                                                              │ 
  │ Thus, if a mail address on the local host is foo@example.org, the correct value for this     │ 
  │ option would be example.org.                                                                 │ 
  │                                                                                              │ 
  │ System mail name:                                                                            │ 
  │                                                                                              │ 
  │ lists.wefi.net______________________________________________________________________________ │ 
  │                                                                                              │ 
  │                          <Ok>                              <Cancel>                          │ 
  │                                                                                              │ 
  └──────────────────────────────────────────────────────────────────────────────────────────────┘ 

Abschluss der Installation

(Reading database ... 21540 files and directories currently installed.)
Removing exim4 ...
dpkg: exim4-config: dependency problems, but removing anyway as you request:
 exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however:
  Package exim4-config is to be removed.
  Package exim4-config-2 is not installed.
  Package exim4-config which provides exim4-config-2 is to be removed.
 exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however:
  Package exim4-config is to be removed.
  Package exim4-config-2 is not installed.
  Package exim4-config which provides exim4-config-2 is to be removed.
Removing exim4-config ...
dpkg: exim4-daemon-light: dependency problems, but removing anyway as you request:
 bsd-mailx depends on exim4 | mail-transport-agent; however:
  Package exim4 is not installed.
  Package mail-transport-agent is not installed.
  Package exim4-daemon-light which provides mail-transport-agent is to be removed.
Removing exim4-daemon-light ...
Stopping MTA: exim4_listener.
Removing exim4-base ...
Processing triggers for man-db ...
Selecting previously deselected package postfix.
(Reading database ... 21404 files and directories currently installed.)
Unpacking postfix (from .../postfix_2.5.5-1.1_i386.deb) ...
Processing triggers for man-db ...
Setting up postfix (2.5.5-1.1) ...
Adding group `postfix' (GID 108) ...
Done.
Adding system user `postfix' (UID 104) ...
Adding new user `postfix' (UID 104) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID 109) ...
Done.
setting myhostname: lists.wefi.net
setting alias maps
setting alias database
changing /etc/mailname to lists.wefi.net
setting myorigin
setting destinations: lists.wefi.net, localhost.wefi.net, , localhost
setting relayhost: 
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
WARNING: /etc/aliases exists, but does not have a root alias.

Postfix is now set up with a default configuration.  If you need to make 
changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfix.
lists:~# 

Überprüfung der Mailzustellung

Ob die Mailzustellung nun funktioniert, überprüfen wir mit telnet (wie in TCP Port 25 (smtp) Zugriff mit telnet überprüfen beschrieben):

ubuntu@ubuntu:~$ telnet lists.wefi.net 25
Trying 80.66.32.103...
Connected to lists.wefi.net.
Escape character is '^]'.
220 lists.wefi.net ESMTP Postfix (Debian/GNU)
EHLO test.example.com
250-lists.wefi.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: test@example.com
250 2.1.0 Ok
RCPT TO: postmaster@lists.wefi.net
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Testnachricht

Das ist ein Test.

.
250 2.0.0 Ok: queued as 87D2CDE40A2
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
user@ubuntu:~$ 

Am Server ist diese Nachricht nun zugestellt:

lists:~# mail
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/root": 1 message 1 new
>N  1 test@example.com  Tue Jun  1 10:00   16/545   Testnachricht
& 1
Message 1:
From test@example.com  Tue Jun  1 10:00:49 2010
X-Original-To: postmaster@lists.wefi.net
Subject: Testnachricht
Date: Tue,  1 Jun 2010 10:00:08 +0200 (CEST)
From: test@example.com
To: undisclosed-recipients:;

Das ist ein Test.


& q
Saved 1 message in /root/mbox
lists:~# 

Weitere Informationen


Foto Werner Fischer.jpg

Autor: Werner Fischer

Werner Fischer arbeitet im Product Management Team von Thomas-Krenn. Er evaluiert dabei neueste Technologien und teilt sein Wissen in Fachartikeln, bei Konferenzen und im Thomas-Krenn Wiki. Bereits 2005 - ein Jahr nach seinem Abschluss des Studiums zu Computer- und Mediensicherheit an der FH Hagenberg - heuerte er beim bayerischen Server-Hersteller an. Als Öffi-Fan nutzt er gerne Bus & Bahn und genießt seinen morgendlichen Spaziergang ins Büro.


Das könnte Sie auch interessieren

Debian GNU/Linux
Netzwerkkonfiguration in Debian
Samba Freigabe mit Authentifizierung