banner Debian GNU/Linux

Linux Mail Server

mail server with anti-virus protection and spam filtering

This is part of a write-up of an attempt to use Linux as a "Small Business Server", and describes the configuration of a mail server.

Mail on Linux (or Unix) is about as old as the internet itself. The first mail systems would simply drop text files (the mail messages) into a designated directory (the mailbox) on a given compter where the user could go and read them. Over time, additional tools were developed to add functionality and features. In true Unix style, a Linux 'mail system' consists of a collection of tools that work together to provide an email service.

User accounts

To set up a mail system, you first need to decide which mail domain the mail server is responsible for. In a Home / Small Business context, this is most likely a single domain, eg, and the mail server will be handling mail send from and to addresses such as and These people will need to have user accounts on the server, so the get a home directory where you can create a subdirectory that can act as a mailbox.


For external mail to be deliverable, external mail servers need to be able to find out where your mail server is. This is done through MX (Mail Exchange) records in DNS. Most likely, your ISP provider will handle those. It consists of an MX record that says that eg '' is the mail server for the domain, and that it's address is

Whatever computer on the internet that has to deliver an e-mail message to will use DNS to find that address, and deliver it to the mail server (the MTA, Mail Transfer Agent), who will pass it on to some other programs for further processing.

Mail Server

Here's a clear and concise mini-howto about setting up a mail server on Debian ((c)Brian J. Densmore, Creative Commons License) . The proposed system consists of

Spam- and Virus filtering

To add email filtering functionality to our mail server, we apt-get install the following packages :

note that clamav-freshclam assumes a permanent internet connection - not unusual for a mail server. If, however, there is no permanent internet connection, clamav can work with clam-data, downloaded signature files

During the installation, you provide the following information :


To mimic Microsoft Exchange Sever, you also need some Groupwarefunctionality.

Koen Noens
October 2005