Complete Virtual Mail Server/System Setup and Packages

From Gentoo Wiki
Jump to: navigation, search
Other languages:
English • ‎日本語 • ‎한국어 • ‎русский

System deployment

Since multi-system installations aren't exotic anymore, multiple possibilities exists to do just that or to just keep everything on one box.

Optional packages

Since a webserver (apache recommended) is required for things such as webmail and postfixadmin, one of these should be installed. Instructions for installing Apache and for PHP can be found on the wiki.

Note
For the impatient, installing apache with php is as simple as setting the proper USE flags and emerging dev-lang/php which will pull in www-servers/apache.

The following USE flags should be set as a minimum:

FILE /etc/portage/package.use
dev-lang/php apache2 imap postgres mysql
Note
Unless explicitly needed, only install one of the required database USE flags.

Then just install dev-lang/php:

root #emerge --ask dev-lang/php

Required packages

Unlike apache/php as mentioned above, the following packages are required. If there is a choice between different packages, of course only install those packages needed. E.g. don't install both mysql and postgres (unless they are used for different purposes of course). Some packages may be pulled in depending on the USE flags set for other packages.

Also, as packages get updated and configuration options change, please update this document where changes where needed in the specific sections.

Below is an overview of packages which will be installed and configured within this document.

On the webserver, these packages need to be installed:

On the mailserver, these packages need to be installed:

Prerequirements

At this point most users just want to get to the good stuff. Before digging into this, the following is strongly suggested to read through:

  1. READ THIS DOCUMENT. This is a long document and there are many opportunities to go off the rails. Take the time to become familiar with all of the steps and understand the role that each of the packages play, and recovery from mistakes will be much quicker.
  2. Not all of the packages included in this HOWTO are required to get the basic mail server working. SMTP Authorization, Web Administration Tools, SPAM filtering, etc. are not absolute necessities to offer mail services, just really good things to have. By reading through this first, figure out which ones are required and which ones aren't to save the work of installing them to begin with.
  3. Like all HOWTOs, this one pretty well assumes that everything in the system is going to be where it should be and that everything will go right at each step. In reality, things will go wrong, at which time the web will prove to be an invaluable resource in resolving whatever issues may occur.
  4. A key to testing all of this is having at least one domain (and two would be better to test virtual domains), with the appropriate MX records setup. There are many DNS options out there so a couple of domains and supporting DNS services shouldn't cost more then $10 for the year. This is not the time to go cheap. Invest the money and make life a whole lot simpler.
  5. Pay close attention to the messages displayed after emerging any packages. Depending on the state of the machine when the installation was started, the installation of these packages may result in the need to update some of the configuration files. Use dispatch-conf or etc-update to resolve this. There are no instructions in this HOWTO covering this as this is pretty system-specific.
  6. Be sure that system is up to date. Complete an
    root #emerge --sync
    and
    root #emerge -uDNva @world
    before starting this. A number of problems may occur due to old applications not mixing with new utilities.

Finally, to avoid a lot of rework on this, check USE flags variables in the /etc/portage/make.conf file before starting to compiling anything. If the wrong flags are set, it is most likely that things need to be recompiled later to ensure the support needed to make this work is compiled in.

USE flag Description
authdaemond Needed by courier-imap.
bzip2 Required by the virus scanner.
clamdtop ClamAV 'top' like tool. If heavy load on the mail server exists, due to clamav running a lot, clamdtop can help a lot debugging it.
crypt Crypt functions for PHP. Used for passwords in the web interface.
geoip IP to Location mapping for spamassasin etc.
imap One of the main interfaces offered by this HOWTO to let clients access e-mail.
ipv6 If the system has IPv6 connectivity, enable this. Tested extensively and works well in Postfix, Courier and Apache.
maildir Choose the maildir format supported by Postfix (one of the reasons for choosing Postfix).
mbox Absolutly do not use mbox.
mysql If mysql support is desired enable this.
postgres If postgres support is desired enable this.
sasl Simple Authentication and Security Layer. Strongly recommended.
spamassassin Recommended if spam filtering is required.
spell Spell checking for PHP. Used by webmail.
ssl Secure Socket Layer connections. Strongly recommended.
urandom Used by cyrus-sasl. Strongly recommended.
vda Quota support for postfix. Adds support for virtual delivery agent quota enforcing. No support in Postfix 3.0, which is now stable in portage.
vhosts Support virtual hosts. Strongly recommended.

With the correct USE flags set, emerging just mail-mta/postfix will pull in most, if not all the right packages.

root #emerge --ask postfix