Complete Virtual Mail Server/System Setup and Packages

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.

The following USE flags should be set as a minimum:

Then just install :

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:
 * (optional)

On the mailserver, these packages need to be installed:
 * or

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  or  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  and  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 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.

With the correct USE flags set, emerging just will pull in most, if not all the right packages.