Setting up a mail server – requirements

Over the last month or so I have been playing with a VPS that is hosted at This is fun. So I installed Ubuntu Server 11.10, and have already upgraded to 12.04 LTS. I have access via ssh with key pairs, and even managed to move the WordPress stuff from (the old) to (the new). Later on I will setup virtual domains with Apache and see how that works.

Now I have decided that I need a real challenge: I am going to setup a mail server. My goal is to have this mail server running within a month so I can stop my hosting program and run entirely from the VPS. Am I not a very ambittious guy?

Of course, I am going to rely heavily on what others have done before me. My main sources are listed at the end. They are there to check if I write something silly here.

My requirements for the mail server are the following:

  • Serve mail for, and This is severely over the top. Why do I want this? Because I can.
  • Provide IMAP, POP3 and webmail access.
  • Only allow authenticated and secure connections through SASL and TLS
  • Serve mail for users without Linux login credentials. This means that I don’t want to create a Linux account for everyone who gets an e-mail account.
  • Filter spam as much as possible and make sure that my server will not be used to relay spam.
  • Detect viruses in incoming and outgoing e-mail

How am I going to satisfy these requirements? Here are some first choices to get started:

  • Postfix as smtp server
  • Use virtual mailboxes for separate domains and non-Linux accounts
  • Use MySQL as authentication backend. This means that all domain, account and access data is stored in a MySQL database.
  • Dovecot as IMAP and POP3
  • Use an SSL certificate

The following picture is very helpful for me and taken from Media Temple.


Install Postfix with Dovecot on CentOS on Media Temple. Things work differently on Ubuntu, but this is very close to what I want.

How to set up a mail server on a GNU / Linux system by Ivar Abrahamsen. This does apply to Ubuntu Server, but Ivar uses Courier instead of Dovecot. Still, this is a very thorough document.


Comments are closed.