CentOS 6 Setup Guide

MTA

Installing Postfix

We need an MTA to send or forward local mails. A good choice is Postfix, a well-known MTA (and CentOS' default one).

To install, we issue:

 yum install postfix mailx

If you use the centos-6-x86_64-minimal OpenVZ template, the following fixes need to be applied:

yum remove ssmtp procmail
rm -f /usr/sbin/ssmtp
rm -f /usr/sbin/sendmail.ssmtp
find / -name "*ssmtp*" -delete // delete folders manually

alternatives --remove mta /usr/sbin/sendmail.ssmtp
alternatives --config mta

This may not be required anymore in newer template versions as it is a bug.

Since mails go to /var/spool/postfix/maildrop, we need to enable the Postfix service so it will deliver them to our local mailboxes.

chkconfig postfix on

Forwarding local mails

System mails sent to local user accounts can be forwarded to an external email address. Our MTA - Postfix - supports reading a so-called forwarding file.

echo "{{email_address}}" > ~/.forward // e.g. [email protected]

If you still want copies on the machine, you should add another entry to the file (one per line)

echo "root@localhost" >> ~/.forward