Postfix is a common mail server, many large distributions are shipped with Postfix installed by default. The default configuration allows local mailing only, but that in itself is very useful on a machine used by many users, and even if there is no such traffic, many services dump their reports and messages into e-mails, which is delivered to the
root user locally, so the sysadmin will be noticed on any events of interest when he/she logs in and switches to
A simple example would be scheduled
cron jobs: any output not redirected from the output of a script running from cron will be wrapped to an e-mail and will be delivered to
root‘s mailbox, so the administrator does not even have to make any effort to have the reports of the nightly backup jobs at hand.
While this standalone mode is certainly a nice service as it is, postfix is a full-fledged mail server, capable of receiving, forwarding, relaying, filtering of e-mails, it basically have every feature we need for a mail server.
In this tutorial you will learn:
- How to install postfix on RHEL 8 / CentOS 8
- How to verify the working service with standalone functionality.
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||RHEL 8 / CentOS 8|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to install postfix mail server on RHEL 8 / CentOS 8 step by step instructions
If you didn’t choose the mail server packages when installing the system,
postfix will not be present by default. To install it we will use
dnf, but to do that, Subscription Management repositories must be enabled on the system to reach the software sources we’ll install from.
- To install packages on RHEL 8 / CentOS 8
postfixpackage by using the following command:
# dnf install postfix
- To enable and start systemd service enter:
systemctl enable postfix ; systemctl start postfix
- To verify the service is working we can install the
# dnf install mailx
- As a normal user (named
fooon the lab machine) we write a mail to the admin, in this example we request for more (what else?) disk space:
$ mail root Subject: quota rise request Dear admin, Please increase my disk quota with 1 GB. Thanks, foo . EOT
rootis the recipient. The last line containing only a dot will signal the mail client this is the end of our mail, which will be handed to
- To verify the mail is arrived, log in as
root(the recipient), and type
# mail Heirloom Mail version 12.5 7/5/10. Type ? for help. "/var/spool/mail/root": 1 message 1 new >N 1 foo@rhel8lab Mon Nov 26 19:05 20/634 "quota rise request" &
1is the ID of the message,
foo@rhel8labis the sender (username@hostname), delivery time and the subject can also be seen. By typing the message ID, in this case
enteryou can read your local mail, verifying the mail delivery system is working as intended.