4

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

2 Answers 2

9

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/main.cf

myhostname = mail.somesite.com

mydestination = $myhostname

myorigin = $myhostname

relay_domains = $myhostname

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

3
  • 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, 2010 at 14:30
  • Chances are you'll also need to manually sudo service sendmail stop either before or after you run the install command. Apt will remove the sendmail service, but won't necessarily stop it. Oct 12, 2016 at 17:16
  • I've also found that Postfix doesn't completely remove all of sendmail (specifically, the MSP part is still left running), resulting in failure notifications from broken cron jobs (see discussion here). I manually ran apt-get purge sendmail-base sendmail-cf sendmail-bin to clean things up. Oct 27, 2016 at 20:29
2

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.

1
  • 1
    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, 2010 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy