Linux logo

How to deploy, configure and troubleshoot Postfix on Debian 7 (Wheezy)

Postfix is a free, open source mail transfer agent (MTA) that routes and delivers electronic mail.

I recently decided it might be a good idea to deploy the package in my own local network as it is a central point of configuration to an upstream SMTP server. This will come in handy later on should I decide to physically relocate my hardware and at the same time change my internet service provider.

Run commands without the “#” at the beginning.


  1. #su – root
  2. #apt-get update
  3. #apt-get upgrade
  4. #apt-get install postfixPostfix Installation 1Postfix Installation 2

Configuring SMTP Authentication to Smarthost

If your upstream SMTP host requires SMTP authentication, you will need to create a password file and add it to /etc/postfix/ configuration file.
Ignore if not required

  1. #cd /etc/postfix
  2. #vi password

Add the following line                                [email protected]:password

  • The first part needs to be the upstream SMTP server, this example is, separate by tab and type your username, add a “:” and type your password
  1. #chown root:root password
  2. #chmod 0600 password
  3. #postmap hash:password


#vi /etc/postfix/


  1. “relayhost” to your smart host upstream
  2. “inet_interfaces =” to all


  1. mynetworks = Add network address of internal network
  2. smtp_sasl_auth_enable = yes
  3. smtp_sasl_password_maps = hash:/etc/postfix/password
  4. smtp_sasl_security_options =

Finishing Setup

#postfix check
#postfix reload
#netstat –tannetstat

Check to see Local Address of “” is in a state of “LISTEN”


Check to see if postfix is running by executing the following command:

  1. #ps aux | grep postfix

Open a second terminal and monitor the mail.log file while in another session telnet to the Postfix server on port 25 and attempt to send a message manually

  1. #tail –f /etc/log/mail.log

This is an example of a successful sent email



Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.