Postfix on Slicehost (Fedora 10)

Today I set up a very simple Postfix instance on my Fedora 10 Slicehost VPS. Although Slicehost offers an excellent series of articles on setting up a mailserver, that series assumes that the base OS is Ubuntu Hardy. Naturally, there are some small differences when working with a different distro, and so I wanted to document my observations here.

Scope

I should mention that I only configure Postfix for sending e-mails; I don’t need to receive mail on this VPS at this time. Therefore, these notes only cover half (or, maybe, somewhat less) of the problem of setting up a “full” mailserver. Still, half is better than nothing.

Hostname

First, set the slice’s hostname to a machine name under the domain from which mail will be sent. (This procedure only supports a single domain per slice; later posts may augment it.) It makes things go much more smoothly if the hostname is immediately under the main domain, e.g. foo.bar.com, as opposed to bar.com, quux.foo.bar.com, or some other arrangement.

Two files must be edited; you must change the HOSTNAME value in /etc/sysconfig/network, and the second 127.0.0.1 entry in /etc/hosts. Here are my files after the changes:

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=fire.house-o-games.com
GATEWAY=174.143.252.1

/etc/hosts

127.0.0.1     localhost localhost.localdomain
127.0.0.1     fire.house-o-games.com

(Note that house-o-games.com is just one of several domains I’ve got on the slice; I picked it to be the “official” name of the VPS for convenience.)

DNS

Next, DNS must be configured. In addition to all the normal DNS goodness, which I take as read, e-mail requires (or, at least, makes advisable) two additional bits of business:

  • An appropriate reverse DNS entry must be added for FCrDNS
  • An SPF policy record must be created

My reverse DNS entry is simple enough, mapping my slice’s IP to “house-o-games.com.” (I don’t believe it matters what domain name your rDNS entry maps to, so long as DNS maps that name back to your machine’s IP.)

An SPF record is just a specially-formatted TXT DNS record. Mine has a data field of “v=spf1 a -all“; I authorize any IP listed in any A record of my domain to send mail. (MX records would be more typical, but I’m not configuring any MX records in this simple procedure, so As will have to do.)

Installation

With the preliminaries out of the way, we can install some software. Run this command to get Postfix, as well as the mailx utility (useful for testing):

sudo yum install postfix.x86_64 mailx.x86_64

Now tell Fedora’s Alternatives system to use postfix as its MTA, in preference to sendmail:

sudo alternatives --configure mta

(When prompted, pick /usr/sbin/sendmail.postfix as the MTA.)

Configuration

Edit the /etc/postfix/main.cf file:

sudo emacs /etc/postfix/main.cf

and uncomment these lines:

  • #myorigin = $mydomain
  • #mynetworks_style = host

(The first line sets the default origin to the local host’s domain, and the second restricts Postfix’s “trust” for the purposes of relaying messages to the local machine.)

Edit the /etc/aliases file:

sudo emacs /etc/aliases

and change the last line (#root: marc) to redirect root’s mail to a non-root admin of your choice, (e.g. root: admin).

Just to be safe, update the alias DB:

sudo newaliases

Run Postfix

Set postfix to start at launch, and then run it manually:

sudo chkconfig --add postfix
sudo chkconfig --levels 35 postfix on
sudo service postfix start

Future Work

Not much change in my plans since yesterday; mostly, I’ve just added some planning items:

  • Research widgets (create additional SKUs of the puzzles)
  • Post some messages on puzzle forums
  • Develop a monetization experiment
  • Experiment with an increased ad budget; will it buy traffic?

Yesterday’s Stats

Stat 15th
Visitors 20
Visits 24
Pageviews 98
Pages/Visit 4.08
Avg. Time on Site 5:07

Hrumph. Another dismal day. Clearly, something new is called for; let’s see how the upcoming widgets play out. Also, it might be a good idea to post on some puzzle forums directly.

Follow Along

You can subscribe to my RSS feed, if you’d like to follow along with this month’s project, in which I attempt to create and popularize a puzzle site.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in Projects, Web stuff. Bookmark the permalink.

Comments are closed.