Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

================= Preamble =================

So, I'm a programmer and I thought, "You know, I've had enough of <hosting provider>. It's high time I struck out on my own and moved over to a VPS." Getting Apache, Tomcat, databases, et al. to work was simple -- I've done those all a dozen times on Windows, Linux (Fedora and Ubuntu), and even Mac. But I feel like I've hit a wall when it comes to setting up a mail server.

I'm using CentOS and I need to be able to have this machine send and receive mail from multiple domains. I've only found one set of instructions (here as well as others from that site) but they are clearly incomplete (they don't tell you what your MySQL schema should be). I can't get everything in them to work so I thought I would go to the experts.


Is there a good step-by-step series of instructions on how to configure a CentOS server to send and receive email from multiple domains?


How does one then set the MX record so that I can point mail to my Google account?

share|improve this question

closed as off-topic by masegaloeh, Sven Jan 17 '15 at 16:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

Host email with CentOS :


If you have multiple domains and less then or 10 users, you can use googleapps
Signup for googleapps
Setup GoogleApps on Linode :

If your vps is hosted on Linode - they have very good step by step guides on setting up email servers on nix based platforms.

Following guides may be helpful :

If you haven't already - I would recommend to signup for a Linode :-) with the following link :
Linode Signup

Kind Regards

share|improve this answer

You might take a look at SME server, it is based on CentOS and has Postfix integrated with Horde as a starting point.

share|improve this answer

I will recommend HowToForge as having good step-by-step instructions:

I typically use this setup for authentication:

And this site provides a good overview:

Postfix virtual has some good ideas on database design for virtual users:

A few notes: A nice setup is Dovecot and Postfix - using Postfix for delivery, and Dovecot for authentication and IMAP. In this way you can easily create virtual users (for instance, in MySQL) and don't need to bother with modifying files for each new user/domain. (On the other hand, a pam or flat-file approach might offer slightly better performance).

I would highly recommend Postfix-admin ( ) for use to manage your virtual domains/mail-users

Postfix supports redirecting mail - so your MX record could point to your postfix server, and if you have a redirect setup for that particular address, postfix will deliver the mail to the desired address (either local, or as in your example, GMail). Again, with PFAdmin, you can configure the redirects in a database.

You can setup an MX record pointing at GMail ( which would essentially result in all mail coming to your server ending up at Gmail; but you would still have control over the mail you send from your server (alternatively, you could just use Gmail as your SMTP server as well).

To improve deliverability, I would definitely suggest adding an SPF record to your domain, as well as implementing DKIM/DomainKeys signing (via dkimproxy).

As a webmail interface, SquirrelMail has a small footprint; however RoundCube is more 'modern' - both work well.

Also, run ImapProxy if you will be using IMAP as it greatly reduces server load.

A side note - the configuration files for Dovecot changed for version 2 and most guides reference the 1.x series. Check your version if you use Dovecot.

There are also some control panels (e.g. Webmin/ISPConfig) that will help to configure your server - I would not recommend them though unless you are comfortable enough to undo anything they do.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.