Hacker News new | comments | show | ask | jobs | submit login
Ask HN: What's the best way to setup an email server on a VPS?
8 points by rustc 1462 days ago | hide | past | web | 8 comments | favorite
I have dozens of domains, that get around an email a day each, on which I currently use Google Apps.

I'd like to have a backup option in case Google does something again.

I'd prefer to use a Ubuntu distro, as I have some experience managing it, but I have NO idea on how to setup a server (I could get an answer using Google, but I want a good opinion, not install instructions, although pointers would be nice).

Use an IP where it's unlikely that the last tenant sent lots of spam (budget hosters can be troublesome; don't use consumer DSL; steer very far clear of AWS.) There are sites that allow you to query all major blacklists at once, which may prove useful. Don't worry too much about SPEWS listings, though - they are sufficiently trigger-happy that few hosts will reject your mail just for appearing in SPEWS.

You'll want to point mail.$YOURDOMAIN at this IP, and set up reverse DNS (pointing to mail.$YOURDOMAIN; some hosts check for the "mail" name.)

Start by setting up Postfix (this setup is based on my own of a few years back, and by no means the only way!) Then, when you get annoyed with spam, add countermeasures in this order: postgrey; setting up some Postfix restrictions (no unauthorized pipelining, etc.); blacklists (Spamhaus' ZEN list was good a few years back); dspam. You may want to add clamav for virus filtering if you have non-technical users. You may need to set up amavisd to get clamav working, but I found that amavisd didn't filter all that much more spam than a properly-trained dspam, so I'd start without.

At some point, something will go wrong and you'll lose mail, or receive it much later than you wanted. Add monitoring to fix this - pflogsumm is good to check for mail that shouldn't have been rejected, something like the Simple Event Correlator can monitor your log files, and something like Nagios (or one of the commercial services, Pingdom/uptimerobot/...) can detect when your host goes down.

Good question. I am in thinking this problem. After some thoughts, IMHO, for the individual or small team, the only that we want is a email fowarding server. We do not need a full-fledged email server at all. We can just forward the incoming emails into the destination by a tiny work. We can choose the backend email server like Gmail or others. In this kind of mode, we minimize the cost of a home-made email server. However, excepted that several over-killed servers, I have not found a simple/concise implementation of my idea. It is not hard, and may be a little trivial in fact. I am planning to write a Java or Dart powered. But I have not started on this apsect now:) If other NHers know such kind of a simple email forwarding server app, please share it here for us:)


If you need a really useable web interface, Zimbra community edition might be an option. But it is quite ressource hungry. On the plus side it gives you a premium CalDAV compatible shareable calendar server. Zafara might be a nice alternative to Zimbra.

If you only need a mail server hot standby solution without web interface, then dovecot/postfix might be an option.

Whichever solution you go for, feed it with the mails on the current Gmail server with imapsync or offlineimap. When you want to switch to your own server simply change the MX records of your domain.

Are you sure you really want to maintain a VPS mail server? I've got a little shared hosting account priced at $7.50 / 3 month. (yes, thats ~$2.5/mo) that hosts email for about 25 domains.

I use the plesk control panel to setup addresses, forwards, and catchalls. Works like a charm.

The company is http://www.stablehost.com.

Disclaimer: I am oa customer of theirs. Just pushing them because they are cheap and reliable. No affiliate links.

My opinion, backed by about ten years of experience, is that there is no good way. There are plenty of instructions about how to set up an ISP mail server for 1,000+ users with MySQL out the wazoo, but I found no good howtos for a handful of users. I could never get spam filtering to work right no matter what I tried. I am now using fastmail.

I would totally recommend using a 3rd party app like postmarkapp.com or something similar, especially if you're not a linux/vps guru. The amount of money you will pay will far outweigh the time and issues you'll have to deal with (that is if you have actual working products on those domains).

Oh I have free time :) and I do have a good bit of experience running servers. I've been managing a few VPS's for PHP, Rails, and Node.js apps for over 3 years now.

Plus, I want to learn, so, I'd like to give this a shot, if you have any pointers / suggestions.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact