Install and start Postfix as a local Mail Transfer Agent (MTA)
so the system can deliver service notifications and cron output.
Validate service health, set a basic mail domain, and send a
test message to the local root mailbox.
You are responsible for ensuring that system-generated mail (cron output, security alerts, logrotate notices, and service notifications) is delivered locally. The host does not need to relay mail to the internet, but it must have a working local MTA. You will deploy Postfix, enable it at boot, verify it is running, set the system mail domain, and send a test message to confirm delivery is functional.
A local MTA is often part of baseline Linux operations even in hardened environments. It ensures alerts and automation output do not disappear silently when no external mail relay is configured.
postfix service.
systemctl status.
root user.
apt, pacman, or yum).
systemctl enable --now.
systemctl status.
/etc/mailname.
mail command.
LPIC environments can vary. Use the package manager that
matches your system. In production, prefer the native
toolchain (for example, apt on Debian/Ubuntu,
dnf on RHEL, pacman on Arch).
# Debian/Ubuntu
sudo apt install postfix
# Arch
sudo pacman -S postfix
# RHEL/CentOS (legacy)
sudo yum install postfix
Installing Postfix provides the MTA components that accept mail from local processes and deliver it to local mailboxes (or relay it if configured).
Installing Postfix... Done.
sudo systemctl enable --now postfix
This ensures Postfix starts at boot and begins accepting local mail immediately.
Postfix enabled and started.
systemctl status postfix
Confirm the unit is active and that the master process is running. This is your baseline verification before you start troubleshooting delivery behavior.
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (...; enabled; vendor preset: disabled)
Active: active (running) since Fri 2025-11-28 10:23:45 EST; 5min ago
Main PID: 2143 (master)
echo 'example.local' | sudo tee /etc/mailname
Setting a mail name establishes a default domain identity used by some mail tooling and Postfix configurations. In a real environment, choose a domain that matches your naming standards.
Mail name set to 'example.local'.
echo 'Test message' | mail -s 'Hello' root
This validates the local delivery path. In a real workflow,
you would also verify the mailbox contents (for example with
mail or by inspecting the local spool) and
check logs if delivery fails.
Message sent to local root user.
# View mail queue (if configured)
mailq
# Inspect logs (varies by distro)
journalctl -u postfix --no-pager
# or
tail -n 50 /var/log/mail.log
tail -n 50 /var/log/maillog
These checks help you determine whether mail is stuck in a queue, failing delivery due to configuration, or being rejected by policy. For this lab, the goal is to understand the standard “install, enable, validate, send test mail” workflow.
postfix
: Mail Transfer Agent (MTA) commonly used for local and relay
mail delivery.
systemctl enable --now postfix
: Enables Postfix at boot and starts it immediately.
systemctl status postfix
: Verifies whether the Postfix service is active and running.
/etc/mailname
: Stores the system mail domain on Debian-based systems; may
be referenced by local mail tooling.
mail -s
: Sends a message with a subject to a local user.
mailq
: Shows queued mail messages waiting for delivery.