Install Postfix on CentOS


Install Postfix if it is not currently installed on your system.


Run these commands (CentOS/RHEL):

yum install postfix -y
service postfix start
chkconfig postfix on


By default, most Linux installations come with Postfix already installed. This is not enough to run a full email server, however it is more than sufficient to send an occasional message from the command line, or a script. It is also quite useful if you wish to configure email alerts, such as multiple failed login attempts, or low disk space on the server.

Mail can be sent from command line via the mail command. But what if you encounter the error below?

[root@kitty ~]# mail
Subject: Low Disk Space
Disk space on this server is low.
/usr/sbin/sendmail: No such file or directory
"/root/dead.letter" 11/345
. . . message not sent.

The /usr/sbin/sendmail: No such file or directory message shows that you do not have Postfix (or another mail client) installed. To install Postfix, begin with:

yum install postfix -y

This will install the mailer service in its most basic configuration. Any emails sent will usually have the format user@ where user is the system user account currently being used (such as root or vlad), and is the server's external IP address.

Configure FQDN

If your IP address has an FQDN (Fully Qualified Domain Name, such as, you can configure it in Postfix settings so mail is received from instead. To do so, open the /etc/postfix/ configuration file:

nano /etc/postfix/

Change the following line:

#myhostname = host.domain.tld


myhostname =

Where is your registered fully-qualified domain name assigned to this server.

Start Postfix and Configure Autostart

Make sure to start Postfix so you can send mail:

service postfix start

Also configure it to automatically start at boot:

chkconfig postfix on

Was this article helpful?

mood_bad Dislike 0
mood Like 2
visibility Views: 8685