Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sendmail is running as default as mail server on Ubuntu. How to switch to postfix.

share|improve this question
up vote 5 down vote accepted

I have extensive experience with Postfix.

The quickest and easiest way to do this on Ubuntu is:

sudo apt-get install postfix

This will remove sendmail (it will install a version appropriate for postfix).

You will then need to configure postfix.

Do you also have questions about configuration?

To have decent settings choose "internet site" during the installation process.

You can get away with a config file as short as this:

sudo nano /etc/postfix/

myhostname =

mydestination = $myhostname

myorigin = $myhostname

relay_domains = $myhostname

Be very, very careful about avoiding setting up an open relay server. You'll quickly get blacklisted.

share|improve this answer
You can also define mydomain but postfix is smart enough to get this info from myhostname. If you server hostname is something other then the domain from which you want to send email you would then want to define mydomain. – Patrick R Jan 31 '10 at 14:30

Merely to switch?

sudo apt-get remove sendmail
sudo apt-get install postfix

To do all the configurations afterwards? Not sure - I've not worked with postfix.

share|improve this answer
I would rather do this in ine command, like: aptitude install sendmail- postfix Otherwise all packages requiring a mailserver will be removed. – touchstone Jan 31 '10 at 20:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.