Install and Configure Postfix

Install and Configure Postfix

Creating a mail server is one of the most essential things a Sysadmin needs to do when configuring servers for the first time.

In this artice we will be installing and configuring Postfix on a self-hosted server


  • sudo access to the server

DNS Record

First, we have to create DNS records for the FQDN which will be used for the SMTP. For example:

Type Name Content
A smtp ip-of-server
MX @

Installing Postfix Mailserver

apt update; apt install postfix -y

During installation choose Internet Site:

Then enter the FQDN which will be used to send and receive mails:

When postfix is installed, the configuration file: main.cnf is created in the /etc/postfix directory.

The service status can be checked using:

systemctl status postfix

The postfix can be tested using telnet.