Complete Virtual Mail Server/System Setup and Packages
Since multi-system installations aren't exotic anymore, multiple possibilities exists to do just that or to just keep everything on one box.
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.
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:
dev-lang/php apache2 imap postgres mysql
Unless explicitly needed, only install one of the required database USE flags.
Then just install dev-lang/php:
emerge --ask dev-lang/php
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:
- dev-db/postgresql or dev-db/mysql
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:
- 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.
- 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.
- 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.
- 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.
- 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.
- Be sure that system is up to date. Complete an and
emerge --syncbefore starting this. A number of problems may occur due to old applications not mixing with new utilities.
emerge -uDNva @world
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.
||Needed by courier-imap.|
||Required by the virus scanner.|
||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 functions for PHP. Used for passwords in the web interface.|
||IP to Location mapping for spamassasin etc.|
||One of the main interfaces offered by this HOWTO to let clients access e-mail.|
||If the system has IPv6 connectivity, enable this. Tested extensively and works well in Postfix, Courier and Apache.|
||Choose the maildir format supported by Postfix (one of the reasons for choosing Postfix).|
||Absolutly do not use mbox.|
||If mysql support is desired enable this.|
||If postgres support is desired enable this.|
||Simple Authentication and Security Layer. Strongly recommended.|
||Recommended if spam filtering is required.|
||Spell checking for PHP. Used by webmail.|
||Secure Socket Layer connections. Strongly recommended.|
||Used by cyrus-sasl. Strongly recommended.|
||Quota support for postfix. Adds support for virtual delivery agent quota enforcing. No support in Postfix 3.0, which is now stable in portage.|
||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.
emerge --ask postfix