How to install Postfix on Ubuntu

Here’s a quick guide of installing Postfix (Mail Transfer Agent) on Ubuntu Linux.

To install Postfix type this command:

  sudo apt-get install postfix

/etc/postfix/main.cf is a main configuration file.

At least, configure a hostname in main.cf.

To find out the value of some configuration option type this command, for example, find out the myhostname value:

  postconf -d myhostname

After all the changes have been made to main.cf you should restart the Postfix to apply the changes:

  sudo /etc/init.d/postfix reload