There are two basic steps to installing sendmail. First, you have to compile and install the binary. If sendmail has already been ported to your operating system that should be simple. Second, you must build a run-time configuration file. This is a file that sendmail reads when it starts up that describes the mailers it knows about, how to parse addresses, how to rewrite the message header, and the settings of various options. Although the configuration file can be quite complex, a configuration can usually be built using an M4-based configuration language.
The remainder of this section will describe the installation of sendmail assuming you can use one of the existing configurations and that the standard installation parameters are acceptable. All pathnames and examples are given from the root of the sendmail subtree, normally /usr/src/usr.sbin/sendmail on 4.4BSD.
If you are loading this off the tape, continue with the next section. If you have a running binary already on your system, you should probably skip to section 1.2.
All sendmail source is in the sendmail subdirectory. To compile sendmail, cd into the sendmail directory and type
You can give parameters on the Build command. In most cases these are only used when the obj.* directory is first created. These commands include:
Any other parameters are passed to the make program.
(This section is not yet complete. For now, see the file devtools/README for details.)
Sendmail supports two different formats for the local (on disk) version of databases, notably the aliases database. At least one of these should be defined if at all possible.
If neither of these are defined, sendmail reads the alias file into memory on every invocation. This can be slow and should be avoided. There are also several methods for remote database access:
Other compilation flags are set in conf.h and should be predefined for you unless you are porting to a new environment.
After making the local system configuration described above, You should be able to compile and install the system. The script Build is the best approach on most systems:
If you are installing in the standard places, you should be able to install using
Sendmail cannot operate without a configuration file. The configuration defines the mail delivery mechanisms understood at this site, how to access them, how to forward email to remote mail systems, and a number of tuning parameters. This configuration file is detailed in the later portion of this document.
The sendmail configuration can be daunting at first. The world is complex, and the mail configuration reflects that. The distribution includes an m4-based configuration package that hides a lot of the complexity.
These configuration files are simpler than old versions largely because the world has become simpler; in particular, text-based host files are officially eliminated, obviating the need to hide hosts behind a registered internet gateway.
These files also assume that most of your neighbors use domain-based UUCP addressing; that is, instead of naming hosts as host!user they will use host.domain!user. The configuration files can be customized to work around this, but it is more complex.
Our configuration files are processed by m4 to facilitate local customization; the directory cf of the sendmail distribution directory contains the source files. This directory contains several subdirectories:
If you are in a new domain (e.g., a company), you will probably want to create a cf/domain file for your domain. This consists primarily of relay definitions and features you want enabled site-wide: for example, Berkeley's domain definition defines relays for BitNET and UUCP. These are specific to Berkeley, and should be fully-qualified internet-style domain names. Please check to make certain they are reasonable for your domain.
Subdomains at Berkeley are also represented in the cf/domain directory. For example, the domain CS.Berkeley.EDU is the Computer Science subdomain, EECS.Berkeley.EDU is the Electrical Engineering and Computer Sciences subdomain, and S2K.Berkeley.EDU is the Sequoia 2000 subdomain. You will probably have to add an entry to this directory to be appropriate for your domain.
You will have to use or create .mc files in the cf/cf subdirectory for your hosts. This is detailed in the cf/README file.
This subsection describes the files that comprise the sendmail installation.
The binary for sendmail is located in /usr/sbin. It should be setuid root. For security reasons, /, /usr, and /usr/sbin should be owned by root, mode 755.
This is the configuration file for sendmail . This is the only non-library file name compiled into sendmail .
The configuration file is normally created using the distribution files described above. If you have a particularly unusual system configuration you may need to create a special version. The format of this file is detailed in later sections of this document.
The newaliases command should just be a link to sendmail:
The hoststat command should just be a link to sendmail, in a fashion similar to newaliases. This command lists the status of the last mail transaction with all remote hosts. The -v flag will prevent the status display from being truncated. It functions only when the HostStatusDirectory option is set.
This command is also a link to sendmail. It flushes all information that is stored in the HostStatusDirectory tree.
The directory /var/spool/mqueue should be created to hold the mail queue. This directory should be mode 700 and owned by root.
The actual path of this directory is defined in the Q option of the sendmail.cf file. To use multiple queues, supply a value ending with an asterisk. For example, /var/spool/mqueue/q* will use all of the directories or symbolic links to directories beginning with `q' in /var/spool/mqueue as queue directories. Do not change the queue directory structure while sendmail is running.
If these directories have subdirectories or symbolic links to directories named `qf', `df', and `xf', then these will be used for the different queue file types. That is, the data files are stored in the `df' subdirectory, the transcript files are stored in the `xf' subdirectory, and all others are stored in the `qf' subdirectory.
This is a typical value for the HostStatusDirectory option, containing one file per host that this sendmail has chatted with recently. It is normally a subdirectory of mqueue.
The system aliases are held in /etc/mail/aliases. A sample is given in sendmail/aliases which includes some aliases which must be defined:
Normally sendmail looks at a database version of the files, stored either in /etc/mail/aliases.dir and /etc/mail/aliases.pag or /etc/mail/aliases.db depending on which database package you are using. The actual path of this file is defined in the AliasFile option of the sendmail.cf file.
It will be necessary to start up the sendmail daemon when your system reboots. This daemon performs two functions: it listens on the SMTP socket for connections (to receive mail from a remote system) and it processes the queue periodically to insure that mail gets delivered when hosts come up.
Add the following lines to /etc/rc (or /etc/rc.local as appropriate) in the area where it is starting up the daemons on a BSD-base system, or on a System-V-based system in one of the startup files, typically /etc/init.d/sendmail:
Some people use a more complex startup script, removing zero length qf files and df files for which there is no qf file. For example, see Figure 1 for an example of a complex script which does this clean up.
If you are not running a version of UNIX that supports Berkeley TCP/IP, do not include the -bd flag.
This is the help file used by the SMTP HELP command. It should be copied from sendmail/helpfile:
If you wish to collect statistics about your mail traffic, you should create the file /etc/mail/statistics:
If sendmail is invoked as mailq, it will simulate the -bp flag (i.e., sendmail will print the contents of the mail queue; see below). This should be a link to /usr/sbin/sendmail.