How To Configure Postfix on Ubuntu 24.04

Postfix is a widely used open-source Mail Transfer Agent (MTA) that helps route and deliver email on Linux systems. In fact, around 25% of public mail servers across the internet rely on Postfix. In this guide, we’ll walk you through the steps to install and set up Postfix on an Ubuntu 22.04 server. After that, we’ll test if it’s working properly by installing s-nail, a Mail User Agent (MUA), which essentially functions as an email client.

Step 1 — Installing Postfix

Update your local apt package cache

# apt update

To install the Postfix package, use the command below. Notice that the DEBIAN_PRIORITY=low environment variable is included in this command. Setting this variable ensures that the installation process will prompt you to configure a few additional options during setup.

# DEBIAN_PRIORITY=low apt install postfix

To be explicit, these are the settings used in this guide:

General type of mail configuration?: Internet Site
System mail name: example.com (not mail.example.com)
Root and postmaster mail recipient: The username of your primary Linux account
Other destinations to accept mail for: $myhostname, example.com, mail.example.com, localhost.example.com, localhost
Force synchronous updates on mail queue?: No
Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
Mailbox size limit: 0
Local address extension character: +
Internet protocols to use: all

Finally, complete set up postfix

setting myhostname: mail.localbitscentric.com
setting alias maps
setting alias database
setting myorigin
setting destinations: $myhostname, mail.localbitscentric.com, localbitscentric.com, localhost.localbitscentric.com, , 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
setting inet_protocols: all
# systemctl reload postfix
# systemctl status postfix

When the installation process finishes, you’re ready to make a few updates to your Postfix configuration.

Note: If you need to ever return to change these settings, you can do so by typing:

# dpkg-reconfigure postfix

You can allow connections to the service

# ufw allow postfix

Leave a Reply

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