# Building Courier RPMs

You can build binary Courier RPMs directly from the tarball, using RPM version 4.0.2 or higher. For example:

    rpmbuild -ta courier-version.tar.bz2

Because the RPMs can be built directly from the tarball, binary RPMs will not be distributed separately.

> NOTE:

> The first attempt to build binary RPMs will likely result in an error message requesting additional RPMs to be installed first, such as the LDAP server, MySQL and PostgreSQL databases, and various other development libraries.

> Do not blow off these requirements, and attempt to hack your way around them. Install the required RPMs, and try again. These RPMs are required to build the full complement of Courier packages, and they may be removed after building Courier.

> Parts of Courier that use these optional RPMs will be built into separate, optional subpackages, and will not be required to run Courier. The optional RPMs must be installed only for the duration of the build process.

Note that Courier does not allow itself to be built as root. A single mistake -- especially when trying to build a system-level utility -- can have serious consequences. Therefore the configuration script won't let you. There's an undocumented flag to disable the check, for folks who don't make mistakes :-) See the FAQ for instructions on how to configure RPM to build packages as non-root.

Building the RPM packages yourself will also result in the packages being customized for your system. This procedure builds the following packages:

- `courier.rpm` - the base mail server.
- `courier-smtpauth.rpm` - install this package to enable authenticated ESMTP, in the ESMTP server.
- `courier-ldap.rpm` - module to authenticate against an LDAP directory. Install this module if you would like to use an LDAP directory to authenticate and manage mail accounts. LDAP support requires the OpenLDAP library to be installed. If OpenLDAP development libraries are not installed, this package will be empty.
- `courier-mysql.rpm` - module to authenticate using a MySQL database. Install this module if you would like to use a MySQL database to authenticate and manage mail accounts. If MySQL development libraries are not installed, this package will be empty.
- `courier-pgsql.rpm` - module to authenticate using a PostgreSQL database. Install this module if you would like to use a PostgreSQL database to authenticate and manage mail accounts. If PostgreSQL development libraries are not installed, this package will be empty.
- `courier-fax-version--1.%{_arch}.rpm` - several supporting scripts for sending E-mails by fax.
- `courier-pop3d.rpm` - the POP3 server.
- `courier-imapd.rpm` - the IMAP server.
- `courier-webmail.rpm` - the webmail server.
- `courier-webadmin.rpm` - the web-based administration tool (just the `cgi-bin` wrapper, actually, the remaining files are installed by other packages).
- `courier-maildrop.rpm` - maildrop mail filter (required if you want to implement mail filtering).
- `courier-mlm.rpm` - the couriermlm mailing list manager.
- `courier-sendmail-wrapper.rpm` - install this package to create soft links from `/usr/bin/sendmail`, `/usr/lib/sendmail`, and several other popular places, to Courier's sendmail wrapper. This package will not be created on Red Hat 7.3 and later, which uses the Debian-derived alternatives mechanism. The alternatives mechanism will be incorporated into the main Courier package.
- `courier-maildrop-wrapper.rpm` - install this package to create soft links in the `/usr/local/bin` subdirectory, for applications which expect to find `maildrop` in the `/usr/local/bin` directory. `maildrop` is also available as a standalone package, which normally installs in the `/usr/local/bin` subdirectory. Courier includes an integrated version of `maildrop`, and you can install this package to allow applications that are configured for the standalone `maildrop` version to use Courier's integrated version instead.

NOTE: these packages are built with certain directories in a non-default location. Specifically, the configuration files are installed in `/etc/courier`, the mail spool is installed in `/var/spool/courier`, and the manual pages are installed directly in `/usr/man`. Other configuration settings are left at their defaults. If you need to change the defaults, you will have to build your own packages.

NOTE: the first time the system boots after installing the Courier RPM, the system may pause for several minutes at the "Starting Courier" prompt. That's because the startup script automatically creates test SSL certificates the first time the script is executed (provided that SSL support is available). This can take as much as 5-6 minutes on a slow machine. Subsequent starts should take only a few seconds. Have patience. Also note that the main Courier RPM has the ESMTP server turned off. You must manually enable receiving mail via ESMTP by editing the `esmtpd` configuration file.