E-mail

The simplest way of setting e-mail up is to use system user accounts and authentication and plain text files for virtual hosting of domains. The downside is that all e-mail users need active shell accounts for this to work, but if you're doing your own machine you need that anyway so it's no big deal. It's only when you want to provide e-mail for other people who don't want/need shell access that it becomes an issue, and it can be worked around by giving them a shell that just logs them out. More elaborate setups can be done using virtual mailboxes and the MySQL database, and you can combine virtual mailboxes and system accounts to provide all the security of separate system accounts for each person without needing to give everyone shell access.

I'll cover both the SMTP server (receiving mail, and acting as a mail host for your outbound mail so you aren't dependent on your ISP's mail servers) and the POP/IMAP server (so you can read mail in a mail client). I use Postfix and Dovecot, so those are what'll be covered here. You'll need to have these packages installed (at least on a Linode server, I don't think there's anything missing that wouldn't automatically be in place on other Debian-based servers):
  • postfix
  • postfix-mysql
  • postfix-doc
  • mysql-client
  • mysql-server
  • dovecot-common
  • dovecot-imapd
  • dovecot-pop3d
  • libsasl2-2
  • libsasl2-modules
  • libsasl2-modules-sql
  • sasl2-bin
  • libpam-mysql
  • openssl
  • mailutils