In the past, many SMBs were content to let their Internet Service Providers (ISPs) handle e-mail services. But now they're interested in running mail servers onsite, due to the widespread adoption of relatively inexpensive, high-speed, and always-on Internet access. Not to mention the ever-increasing amounts of e-mail being transmitted.
In this Recipe, I'll show you how to build a mail server for your SMB clients using simple, commodity PC hardware, the FreeBSD operating system, and several pieces of freely available open-source software. At first blush, this may appear to be a daunting task. But by following the steps in this Recipe, you'll find it's not difficult at all. In fact, you should be able to build the entire setup in just a couple of hours.
System builders who take advantage of this Recipe stand to increase their business with SMBs by fulfilling their need for low-cost, reliable, and on-site e-mail servers. Because the open-source software I recommend in this Recipe is well-suited to white box hardware, system builders have a wide variety of hardware they can use for such servers. Your customers will appreciate the control and security of a customized onsite solution, which can pay for itself in saved hosting fees.
This is Part 1 of a two-part Recipe. In this first part, I'll show you how to use FreeBSD, Postfix, and Dovecot to create a secure, basic e-mail server for a single domain. Then, in Part 2, I'll show how to add extended functionality—including spam detection, virus filtering, and Webmail access—to the basic server we'll build in this first part. Let's get started.
Ingredients: Software
Operating System: We'll use FreeBSD 6. Like Linux, FreeBSD is an open-source UNIX OS. But unlike Linux, which is, strictly speaking, just a kernel, FreeBSD was developed as an integrated OS. It is stable, secure, and designed for networking. FreeBSD also has excellent tools for remote management. In fact, several large Internet sites, including Yahoo, use FreeBSD for their heavy-duty networking tasks.
FreeBSD can be installed using a few different methods, but the one I suggest is to begin by booting from Disc 1 of the CD install set. You can either buy them from a plethora of vendors or download the ISO files from the FreeBSD.org site. Then burn them to disc using an application like Nero Ultra Edition on Windows, available directly from Nero.
FreeBSD 6.1 was released just as this article was going to press. While I used FreeBSD 6 in preparing this Recipe, my instructions apply to version 6.1 as well.
SMTP Service: Mail servers use the Simple Mail Transport Protocol (SMTP) to send and receive e-mail across the Internet. FreeBSD's default SMTP daemon or service is Sendmail. I prefer using Postfix in lieu of Sendmail. It's designed as a drop-in replacement that's more secure and simpler to configure.
E-mail Access: The system also needs something that lets users connect to receive e-mail from their mailboxes. The most common protocols for this are Post Office Protocol v3 and Internet Message Access Protocol v4 (POP3 and IMAP4, respectively). We'll use Dovecot, another open-source program written to provide better security than its predecessors. Dovecot implements the POP3 and IMAP protocols; it does not replace them.
Ingredients: Hardware
Here's the hardware we'll use for this Recipe.
While FreeBSD is available for several hardware platforms, I suggest you use common Intel or AMD PC hardware. FreeBSD makes efficient use of available resources, but handling e-mail can be demanding of system resources if you're serving a large number of users—especially when spam filters and virus filters are factored in. In light of this, I recommend the following minimum hardware:
Before you buy anything, I highly recommend consulting the hardware compatibility list in the FreeBSD FAQ from the FreeBSD Documentation Project site. You don't want to waste money on incompatible hardware.