
Do It Yourself
**************

The following guides outline building Cyrus IMAP from a fresh clone of
the GIT repository's branches, or a tarball of a released version.

Unless you specifically need unreleased patches, the tarball package
is recommended as it comes with a number of resources pre-built for
you, such as the documentation.

======================================================================

* 1. Fetch the source

  * From Tarball

  * From GIT

* 2. Build Dependencies

  * Required Build Dependencies

  * Optional Build Dependencies

    * Developers only

    * SASL Authentication

    * Alternate database formats

    * CalDAV and/or CardDAV

    * Other

* 3. Configure the Build

  * Default build: mail only

  * Optional dependencies

    * CalDAV and CardDAV

    * Murder

    * Replication

* 4. Compile and install

======================================================================


1. Fetch the source
===================


From Tarball
------------

Download the latest stable tarball : version 2.5.10.

Extract the tarball:

   $ **tar xzvf cyrus-imapd-x.y.z.tar.gz**

Continue with 2. Build Dependencies.


From GIT
--------

Read our Guide to GitHub for details on how to access our GitHub
repository, and fork/clone the source.

Continue with 2. Build Dependencies.


2. Build Dependencies
=====================


Required Build Dependencies
---------------------------

Building a basic Cyrus that can send and receive email: the minimum
libraries required to build a functional Cyrus.


Build Dependencies
^^^^^^^^^^^^^^^^^^

+-----------------------------------+-----------------------------------+-----------------------------------+
| Package                           | Debian                            | RedHat                            |
+===================================+===================================+===================================+
| autoconf                          | autoconf                          | autoconf                          |
+-----------------------------------+-----------------------------------+-----------------------------------+
| automake                          | automake                          | automake                          |
+-----------------------------------+-----------------------------------+-----------------------------------+
| bison                             | bison                             | bison                             |
+-----------------------------------+-----------------------------------+-----------------------------------+
| Cyrus SASL                        | libsasl2-dev                      | cyrus-sasl-devel                  |
+-----------------------------------+-----------------------------------+-----------------------------------+
| flex                              | flex                              | flex                              |
+-----------------------------------+-----------------------------------+-----------------------------------+
| gcc                               | gcc                               | gcc                               |
+-----------------------------------+-----------------------------------+-----------------------------------+
| gperf                             | gperf                             | gperf                             |
+-----------------------------------+-----------------------------------+-----------------------------------+
| jansson                           | libjansson-dev                    | jansson-devel                     |
+-----------------------------------+-----------------------------------+-----------------------------------+
| libtool                           | libtool                           | libtool                           |
+-----------------------------------+-----------------------------------+-----------------------------------+
| ICU                               | libicu-dev                        | libicu                            |
+-----------------------------------+-----------------------------------+-----------------------------------+
| uuid                              | uuid-dev                          | libuuid-devel                     |
+-----------------------------------+-----------------------------------+-----------------------------------+
| openssl                           | libssl-dev                        | openssl-devel                     |
+-----------------------------------+-----------------------------------+-----------------------------------+
| pkgconfig                         | pkg-config                        | pkgconfig                         |
+-----------------------------------+-----------------------------------+-----------------------------------+
| sqlite                            | libsqlite3-dev                    | sqlite-devel                      |
+-----------------------------------+-----------------------------------+-----------------------------------+


Optional Build Dependencies
---------------------------

The following build dependencies are optional, and enable
functionality, code maintenance tasks or building the documentation.


Developers only
~~~~~~~~~~~~~~~

+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Package              | Debian          | RedHat          | Requ  | Notes                                         |
|                      |                 |                 | ired  |                                               |
|                      |                 |                 | for   |                                               |
|                      |                 |                 | "make |                                               |
|                      |                 |                 | chec  |                                               |
|                      |                 |                 | k"?   |                                               |
+======================+=================+=================+=======+===============================================+
| CUnit                | libcunit1-dev   | cunit-devel     | yes   | Development headers for compiling Cyrus       |
|                      |                 |                 |       | IMAP's unit tests.                            |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| perl(ExtUtils::Make  | ??              | ??              | no    | Perl library to assist in building extensions |
| Maker)               |                 |                 |       | to Perl.  Configure option: "--with-perl"     |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| perl-devel           | perl-dev        | perl-devel      | no    | Perl development headers to allow building    |
|                      |                 |                 |       | binary perl libraries. Needs version 5+.      |
|                      |                 |                 |       | Configure option: "--with-perl"               |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| valgrind             | valgrind        | valgrind        | no    | Performance and memory testing.               |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+


SASL Authentication
~~~~~~~~~~~~~~~~~~~

+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Package              | Debian          | RedHat          | Requ  | Notes                                         |
|                      |                 |                 | ired  |                                               |
|                      |                 |                 | for   |                                               |
|                      |                 |                 | "make |                                               |
|                      |                 |                 | chec  |                                               |
|                      |                 |                 | k"?   |                                               |
+======================+=================+=================+=======+===============================================+
| Cyrus SASL Plain     | libsasl2-modul  | cyrus-sasl-     | yes   | Cyrus SASL package that ships the library     |
|                      | es              | plain           |       | required to pass Cyrus IMAP's PLAIN           |
|                      |                 |                 |       | authentication unit tests.                    |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Cyrus SASL MD5       | libsasl2-modul  | cyrus-sasl-md5  | yes   | Cyrus SASL library required to pass Cyrus     |
|                      | es              |                 |       | IMAP's DIGEST-MD5 authentication unit tests   |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| sasl binaries        | sasl2-bin       | sasl2-bin       | no    | Administration tools for managing SASL        |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Kerberos             | libsasl2        | krb5-devel      | no    | Development headers required to enable        |
|                      | -modules-       |                 |       | Kerberos v5 authentication capabilities.      |
|                      | gssapi-mit      |                 |       | Otherwise also known as the authentication    |
|                      |                 |                 |       | mechanism *GSSAPI*.  Configure option: "--    |
|                      |                 |                 |       | with-krbimpl=mit"                             |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+


Alternate database formats
~~~~~~~~~~~~~~~~~~~~~~~~~~

+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Package              | Debian          | RedHat          | Requ  | Notes                                         |
|                      |                 |                 | ired  |                                               |
|                      |                 |                 | for   |                                               |
|                      |                 |                 | "make |                                               |
|                      |                 |                 | chec  |                                               |
|                      |                 |                 | k"?   |                                               |
+======================+=================+=================+=======+===============================================+
| lmdb                 | lmdb-dev        | lmdb            | no    | Lightning Memory-Mapped Database Manager      |
|                      |                 |                 |       | (LMDB) backend for Cyrus IMAP databases.      |
|                      |                 |                 |       | LMDB requires database environments to be set |
|                      |                 |                 |       | to a (user-configurable) maximum size. The    |
|                      |                 |                 |       | Cyrus backend uses 512MB as default size.     |
|                      |                 |                 |       | Cyrus installations may override this by      |
|                      |                 |                 |       | setting the environment variable              |
|                      |                 |                 |       | CYRUSDB_LMDB_MAXSIZE. The value of this       |
|                      |                 |                 |       | variable must be an integer, optionally       |
|                      |                 |                 |       | followed (without space) by 'mb' or 'gb' to   |
|                      |                 |                 |       | define the maximum size in bytes, megabytes   |
|                      |                 |                 |       | or gigabytes. The size should be a multiple   |
|                      |                 |                 |       | of the OS page size.                          |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| mysql or mariadb     | libmysqlclient- | mysql-devel or  | no    | MariaDB or MySQL development headers, to      |
|                      | dev or          | mariadb-devel   |       | allow Cyrus IMAP to use it as the backend for |
|                      | libmariadb-dev  |                 |       | its databases.  Configure option: "--with-    |
|                      |                 |                 |       | mysql", "--with-mysql-incdir", "--with-       |
|                      |                 |                 |       | mysql-libdir"                                 |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| postgresql           | postgresql-dev  | postgresql-     | no    |                                               |
|                      |                 | devel           |       |                                               |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+


CalDAV and/or CardDAV
~~~~~~~~~~~~~~~~~~~~~

+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Package              | Debian          | RedHat          | Requ  | Notes                                         |
|                      |                 |                 | ired  |                                               |
|                      |                 |                 | for   |                                               |
|                      |                 |                 | "make |                                               |
|                      |                 |                 | chec  |                                               |
|                      |                 |                 | k"?   |                                               |
+======================+=================+=================+=======+===============================================+
| libical              | libical-dev     | libical-devel   | no    | libical >= 0.48 required for scheduling       |
|                      |                 |                 |       | support. **Note:** Linux distributions        |
|                      |                 |                 |       | Enterprise Linux 6 and Debian Squeeze are     |
|                      |                 |                 |       | known to ship outdated **libical** packages   |
|                      |                 |                 |       | versions 0.43 and 0.44 respectively. The      |
|                      |                 |                 |       | platforms will not support scheduling.        |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| libxml               | libxml2-dev     | libxml2-devel   |       | no                                            |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+


Other
~~~~~

+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| Package              | Debian          | RedHat          | Requ  | Notes                                         |
|                      |                 |                 | ired  |                                               |
|                      |                 |                 | for   |                                               |
|                      |                 |                 | "make |                                               |
|                      |                 |                 | chec  |                                               |
|                      |                 |                 | k"?   |                                               |
+======================+=================+=================+=======+===============================================+
| net-snmp             | libsnmp-dev     | net-snmp-devel  | no    | version 4.2 or higher                         |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| openldap             | libldap2-dev    | openldap-devel  | no    | Development headers to enable **ptloader** to |
|                      |                 |                 |       | interface with LDAP directly, for             |
|                      |                 |                 |       | canonification of login usernames to mailbox  |
|                      |                 |                 |       | names, and verification of login usernames,   |
|                      |                 |                 |       | ACL subjects and group membership.  Configure |
|                      |                 |                 |       | option: "--with-ldap"                         |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| tcp_wrappers         | tcp_wrappers    | xx              | no    |                                               |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+
| transfig             | transfig        | xx              | no    |                                               |
+----------------------+-----------------+-----------------+-------+-----------------------------------------------+

Continue with 3. Configure the Build


3. Configure the Build
======================


Default build: mail only
------------------------

   $ **autoreconf -i**
   $ **./configure** [options]

Check the summary after "./configure" completes to ensure it matches
your expectations.

To view all options, and disable or enable specific features, please
see:

   # **./configure --help**

Tip: Passing environment variables as an argument to configure,
  rather than setting them in the environment before running
  configure, allows their values to be logged in config.log.  This is
  useful for diagnosing problems.


Optional dependencies
---------------------

Some features are disabled by default and must be explicitly enable-
idled via configure.

Sieve is enabled by default.


CalDAV and CardDAV
~~~~~~~~~~~~~~~~~~

   "./configure --with-httpd --with-calalarmd"


Murder
~~~~~~

   "`./configure --enable-murder"


Replication
~~~~~~~~~~~

   "`./configure --enable-replication"


4. Compile and install
======================

   cd /path/to/cyrus-imapd

   autoreconf -i
   ./configure [options]

   make

   make check

   make install  # optional if you're just developing on this machine

If this is the first time you've installed Cyrus, read our Basic
Server Configuration guide. It walks through the steps of configuring
the server and sending a sample piece of test mail.
