There are two basic steps to installing sendmail. The hard part is to build the configuration table. 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 table is quite complex, a configuration can usually be built by adjusting an existing off-the-shelf configuration. The second part is actually doing the installation, i.e., creating the necessary files, etc.
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 src subdirectory. If you are running on a 4.4BSD system, compile by typing make. On other systems, you may have to make some other adjustments. On most systems, you can do the appropriate compilation by typing
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 makesendmail is the best approach on most systems:
You may 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: for example, Berkeley's domain definition defines relays for BitNET, CSNET, and UUCP. Of these, only the UUCP relay is particularly specific to Berkeley. All of these are 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-exposed is the Computer Science subdomain with the local hostname shown to other users; cs-hidden makes users appear to be from the CS.Berkeley.EDU subdomain (with no local host information included). You will probably have to update 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 and /etc/sendmail.pid are the only non-library file names 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. 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.
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/aliases. A sample is given in lib/aliases which includes some aliases which must be defined:
Normally sendmail looks at a version of these files maintained by the dbm(3) or db(3) routines. These are stored either in /etc/aliases.dir and /etc/aliases.pag or /etc/aliases.db depending on which database package you are using. These can initially be created as empty files, but they will have to be initialized promptly. These should be mode 644:
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:
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 startup script.
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 lib/sendmail.hf:
If you wish to collect statistics about your mail traffic, you should create the file /etc/sendmail.st:
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.