In this tutorial we will cover the steps needed to install Postfix on your CentOS 6.4, Debian or Ubuntu platform.

Requirements

  • CentOS 6.4, Debian or Ubuntu installed on your computer/server
  • SSH access (Command line access to the server)
  • root privileges
  • Basic skills for working on a Linux environment

Install Postfix

Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers email messages.

We will use the default package manager included inside the corresponding Linux distribution:

CentOS 6.4

Debian/Ubuntu

Configure Postfix

In order to be able to use the Postfix server with Fully Qualified Domain Name (FQDN) you should configure the service correctly. The main Postfix configuration file is called /etc/postfix/main.cf:

Generally you will need to edit the following lines from the configuration file:

If some of the above mentioned lines is missing or it is commented you should add/uncomment it.

Here is a short explanation of the Postfix variables:

myhostname: the host name of the system
mydomain: the domain name for the email server
myorigin: is the domain name that locally-posted email appears to have come from
inet_interfaces: sets the network interfaces that Postfix can receive mail on. These need to include at least localhost.
mydestination: the list of domains that will be delivered to
mynetworks: a list of trusted IP addresses that may send or relay mail through the server. Users attempting to send email through the server using IP addresses not listed here will be rejected.
relay_domains: a list of destination domains this system will relay mail to. If set to blank we ensure that the mail server isn't acting as an open relay for untrusted networks.
home_mailbox: sets the path of the mailbox relative to the users home directory. Also specifies the style of mailbox to be used - Maildir or Mailbox formats
net_interfaces: Enable IPv4, and IPv6 if supported

Test the functionality of the Postfix service

The Postfix service can be tested the following way. You can access the server on the default SMTP port 25:

You should see prompt similar to the following one:

Now you can use the SMTP commands:

After the data command you can write the body of the email message. When you are ready you can set the end of the body by placing a dot on new line. The full output displayed on your end should be similar to the following one:

Start Up Postfix automatically on server boot

In order for the Postfix service to start automatically upon server boot up you can execute the following command:

CentOS 6.4

Ubuntu/Debain:

At the end you should have a working Postfix service on your Linux platform.