Changing from Sendmail to Postfix on Debian


Our production servers had sendmail on them, and we wanted to upgrade to postfix. Our specific requirement is that each production server sends emails but doesn’t receive them. This was on Debian Squeeze, not sure about Etch or Lenny. You will need to have root access and control the whole box, i.e. you are on a dedicated server.

As always, try at your own risk.

Here’s how we did it:

MAKE SURE YOU ARE LOGGED IN AS ROOT

===========================

/etc/init.d/sendmail stop
apt-get install postfix

[Selected ‘no configuration’]

cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
vim /etc/postfix/main.cf

Insert at the end of this file..

##################################################################
#
# CUSTOM SETTINGS
# by Me on todaysDate
#
##################################################################
# Mail should all be from (e.g automailer@mydomain.com)
myorigin = mydomain.com
# Can comment the next line out if we can get myhostname from /etc/hostname
#myhostname = subdomain.mydomain.com
#No relaying!
relayhost =
relaydomains =
mynetworks_style = host
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled
# Use TLS, if the recipient's mail server has the capability
smtp_tls_security_level = may
##################################################################

Now disable local

vim /etc/postfix/master.cf
Comment out local
#local unix - n n - - local

Start postfix..

/etc/init.d/postfix start

Check the version

postconf -d | grep mail_version

Try an email – it might go to junk mail!

echo "testing external domain delivery" | mail -s "test email to outside world" myemailAddress@mydomain.com

Check sendmail has been removed (it should say it is already removed)

apt-get remove sendmail

Check to see postfix is fired up, not sendmail!

tail /var/log/mail.log

Also – check the message headers in the email you get, to see if it has used TLS (of course, this depends on whether or not your mail server supports it).

Advertisements

About saasmd

I am an experienced software-as-a-service entrepreneur, based in London, UK. I love building interesting software businesses. My current venture is StorIQ, a platform to help bricks-and-mortar retailers manage their operations more effectively. This blog is a space to share low-level techie stuff that I think other people will find useful.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s