C.4. Installation
After you have successfully compiled Postfix, you are ready to install it. You will have to be the root user in order to perform the installation steps.
You need to create a dedicated account that will own the Postfix queue and most of its processes. The account should not permit logins and does not need a shell or a home directory. Use your normal administrative tools to create an account. You can set the password to * and its home directory and shell to invalid paths (something like /bin/false or /dev/null). By convention the username should be postfix. The entry in /etc/passwd should resemble the following:
postfix:*:1001:1001:postfix:/no/where:/bin/false
You must also create a dedicated group that is not used by any user account, including the postfix account you just created. By convention the group name is postdrop. On most systems you create groups be editing the /etc/group. Add a line like the following:
postdrop:*:1007:
Remember that Postfix is a replacement for Sendmail, and in order to maintain compatibility it installs its own sendmail binary in place of your existing one. You may want to rename the existing one to save it from being overwritten. Depending on your platform your existing sendmail is commonly in /usr/sbin/sendmail or /usr/lib/sendmail. You should be able to determine the exact location of your sendmail by executing:
# whereis sendmail
This may list a number of files. You are looking for the binary that has no extension. Once you have found it, rename it to move it out of the way:
# mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
You will also want to rename two other files that will be replaced by Postfix: mailq and newaliases. These are commonly found in the /usr/bin directory, but you can use the whereis command to locate them if necessary. These commands might be symbolic links on your systems:
# mv /usr/bin/mailq /usr/bin/mailq.orig # mv /usr/bin/newaliases /usr/bin/newaliases.orig
Now you are ready to run the installation script.
Make sure you are still the root user and still in the Postfix distribution directory. Execute the installation script:
# make install
After checking that everything is built, the installation script asks you a few questions about setting up Postfix on your system:
install_root: [/]
The install_root directory is the root directory of your system. The only time you would want to change this is if you are creating an installable package. Package builders often want to keep all of the files together in a separate subdirectory in order to bundle them up when creating an installable distribution:
tempdir: [/home/kdent/postfix-2.0.10]
The tempdir directory is a place where the installation script can write temporary files. It defaults to your current directory and cleans up after itself. If for some reason you want the installation script to use another directory, specify it here:
config_directory: [/etc/postfix] daemon_directory: [/usr/libexec/postfix] command_directory: [/usr/sbin] queue_directory: [/var/spool/postfix] sendmail_path: [/usr/lib/sendmail] newaliases_path: [/usr/bin/newaliases] mailq_path: [/usr/bin/mailq]
You should probably accept the defaults for the questions that involve the location of the various Postfix files. Just be sure that the default values presented by the installation script match the directories you found with the whereis command for your original copies of sendmail, newaliases, and mailq. If they don't, you should type in the correct path when the installation script prompts you for it.
mail_owner: [postfix]
The mail_owner defaults to postfix, and assuming that you followed the instructions earlier, you can accept that value. If you created an account with a different username, enter that here.
setgid_group: [postdrop]
The setgid property defaults to postdrop, and assuming you followed the instructions earlier, you can accept that value. If you created a group with a different name, enter that here.
manpage_directory: [/usr/local/man]
For installation of the Postfix man pages, you can accept the default or type in a more appropriate place on your system.
sample_directory: [/etc/postfix]
The sample configuration files contain explanations for Postfix parameters and should be included in your installation. If you prefer not to have them in your configuration directory, you can specify a different location here.
readme_directory: [no]
The Postfix distribution includes several README files with additional information about particular features and add-on packages. These are less critical for the regular maintenance of your Postfix server than the sample configuration files, but if you would like to include them on your system, specify a path where they should be installed. If you don't install them, they are still available in the distribution directory.
The installation script then installs all of the necessary files.
C.4.1 Upgrading
If Postfix is already installed on your system, you can upgrade it when you have a new compilation or version to install. It's usually best to stop Postfix before performing the upgrade. The upgrade process is not interactive but requires that the main.cf file exist on your system already:
# postfix stop # make upgrade # postfix start
Postfix checks for changed files and replaces them with newer versions from your new compilation. Be sure to check the log file after restarting Postfix.