# Problème d'installation de postfix en mode relay - Résolu

**URL:** <https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434>\
**Category:** Support Debian\
**Created:** [Août 31, 2018, 10:08 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434 "2018-08-31T10:08:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurelienazerty](https://www.debian-fr.org/user_avatar/www.debian-fr.org/aurelienazerty/32/7254_2.png) [@Aurelienazerty](https://www.debian-fr.org/u/Aurelienazerty)\
**Post date:** [Août 31, 2018, 10:08 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/1 "2018-08-31T10:08:18Z")

</div>

Bonjour,

Je cherche à installer postfix en mode relay depuis ma VPS vers un serveur SMTP sparkpost.

Voici mon fichier [main.cf](http://main.cf) :

```
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

mynetworks_style = host

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myorigin = /etc/mailname
mynetworks = 127.0.0.0/8 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

#conf sparkpostmail
smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = static:SMTP_Injection:<MACLE>
relayhost = [smtp.sparkpostmail.com]:587
smtp_sasl_security_options = noanonymous 
smtp_tls_security_level = encrypt
header_size_limit = 4096000
#fin conf sparkpostmail

```

Mais le truc c’est que si je regarde dans les log `/var/log/mail.err` j’ai ceci :

```
Aug 31 12:05:44 postfix/master[4385]: fatal: bind 0.0.0.0 port 25: Address already in use
Aug 31 12:05:45 postfix/master[4384]: fatal: daemon initialization failure
Aug 31 12:05:46 postfix/postfix-script[4392]: fatal: mail system startup failed

```

Par avance, merci de votre aide.

---

<div class="post-metadata">

**Author:** ![mattotop](https://www.debian-fr.org/user_avatar/www.debian-fr.org/mattotop/32/3942_2.png) [@mattotop](https://www.debian-fr.org/u/mattotop)\
**Post date:** [Août 31, 2018, 10:20 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/2 "2018-08-31T10:20:09Z")

</div>

Ca ne semble pas être un probléme de config: tu as juste déjà un programme qui écoute sur le port 25.  
Que dit **netstat -plant** en root ?  
Comment lances tu postfix ?

---

<div class="post-metadata">

**Author:** ![Aurelienazerty](https://www.debian-fr.org/user_avatar/www.debian-fr.org/aurelienazerty/32/7254_2.png) [@Aurelienazerty](https://www.debian-fr.org/u/Aurelienazerty)\
**Post date:** [Août 31, 2018, 10:53 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/3 "2018-08-31T10:53:55Z")

</div>

> [@mattotop](#):
>
> netstat -plant

En effet, y a sendmail :

```
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 19826/mysqld
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 9563/sendmail: MTA:
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 780/memcached
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 30603/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 30603/dovecot
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 501/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 825/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9563/sendmail: MTA:
tcp 0 464 92.222.72.116:22 86.194.59.172:52877 ESTABLISHED 9486/sshd: teamazer
tcp 0 0 92.222.72.116:56652 67.199.248.27:80 TIME_WAIT -
tcp6 0 0 :::110 :::* LISTEN 30603/dovecot
tcp6 0 0 :::143 :::* LISTEN 30603/dovecot
tcp6 0 0 :::111 :::* LISTEN 501/rpcbind
tcp6 0 0 :::80 :::* LISTEN 845/apache2
tcp6 0 0 :::8080 :::* LISTEN 845/apache2
tcp6 0 0 :::8081 :::* LISTEN 845/apache2
tcp6 0 0 :::21 :::* LISTEN 818/vsftpd
tcp6 0 0 :::22 :::* LISTEN 825/sshd
tcp6 0 0 :::443 :::* LISTEN 845/apache2
tcp6 0 0 92.222.72.116:443 86.194.59.172:53243 TIME_WAIT -
tcp6 0 0 92.222.72.116:443 66.220.149.25:62264 TIME_WAIT -
tcp6 0 0 ::1:38776 ::1:8080 TIME_WAIT -
tcp6 0 0 92.222.72.116:443 86.194.59.172:53251 TIME_WAIT -
tcp6 0 0 ::1:38774 ::1:8080 TIME_WAIT -
tcp6 0 0 92.222.72.116:443 86.194.59.172:53246 TIME_WAIT -

```

Pourtant il me semblait l’avoir viré, mais voilà ce que je viens de faire à l’instant :

```
root# apt-get --purge remove sendmail
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Le paquet « sendmail » n'est pas installé, et ne peut donc être supprimé
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.

```

> [@mattotop](#):
>
> Comment lances tu postfix ?

Via un simple : `/etc/init.d/postfix start`

---

<div class="post-metadata">

**Author:** ![mattotop](https://www.debian-fr.org/user_avatar/www.debian-fr.org/mattotop/32/3942_2.png) [@mattotop](https://www.debian-fr.org/u/mattotop)\
**Post date:** [Août 31, 2018, 12:03 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/4 "2018-08-31T12:03:40Z")

</div>

> [@Aurelienazerty](#):
>
> Pourtant il me semblait l’avoir viré, mais voilà ce que je viens de faire à l’instant :

Bon, mais aprés, tu vérifies qu’il est arrêté ( **netstat -plant | grep «&nbsp;127.0.0.1:25&nbsp;»** ne doit rien trouver), et si ce n’est pas arrêté, **systemctl stop sendmail.service** (c’est la nouvelle manière de causer aux services avec systemd, même si la plupart des commandes habituelles initrd fonctionnent toujours, il faut s’y habituer)

> [@Aurelienazerty](#):
>
> Via un simple : /etc/init.d/postfix start

**systemctl start postfix.service**

---

<div class="post-metadata">

**Author:** ![Aurelienazerty](https://www.debian-fr.org/user_avatar/www.debian-fr.org/aurelienazerty/32/7254_2.png) [@Aurelienazerty](https://www.debian-fr.org/u/Aurelienazerty)\
**Post date:** [Août 31, 2018, 12:30 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/5 "2018-08-31T12:30:31Z")

</div>

Effectivement `netstat -plant | grep “127.0.0.1:25”` ne renvoi rien.  
Le `systemctl start postfix.service` n’a pas plus de succès, j’ai toujours les mêmes erreurs dans les logs.

---

<div class="post-metadata">

**Author:** ![Aurelienazerty](https://www.debian-fr.org/user_avatar/www.debian-fr.org/aurelienazerty/32/7254_2.png) [@Aurelienazerty](https://www.debian-fr.org/u/Aurelienazerty)\
**Post date:** [Août 31, 2018, 1:44 UTC](https://www.debian-fr.org/t/probleme-dinstallation-de-postfix-en-mode-relay-resolu/77434/6 "2018-08-31T13:44:49Z")

</div>

J’ai fini par trouver à force de recherche Qwant 😉

Donc il faut faire un **`lsof -Pni | grep LIST | grep ":25"`** puis relancer postfix `service postfix restart`
