Article ID: 1161, created on Oct 6, 2008, last review on Jul 26, 2016

  • Applies to:
  • Plesk 10.4 for Linux/Unix


Download Qmail sources from (for example). Apply Plesk patches which are attached to this article, apply your own patches, and compile Qmail. Complete these steps:

  1. Adjust value of __FD_SETSIZE system constant in typesizes.h and posix_types.h to at least 2000 as described in 260.

  2. Review your custom patches and Plesk patches to determine the custom patch changes and when they should be applied: before Plesk patches, after them, or in the middle before/after some specific patch.

    NOTE: For Plesk 8.3 and above Qmail patches should be applied in alphabetical order. For Plesk 8.2, first apply all patch* files and then fr49-quota-patch. For example:

     # cd qmail-1.03
     # for patch in ../patches/patch* ; do patch -p0 < $patch ; done
     # patch -p0 < ../patches/fr49-quota-patch
  3. Change conf-users and conf-groups files to match changes applied in patch-pe and patch-pf patches. Those files should contain records in format 'groupname GID' or 'username UID'. Below are the commands that will put correct records into these files.

    NOTE: These commands should be run on a system where Qmail is already installed, i.e. where Plesk is already installed.

    # grep -E '^(qmail|alias)' /etc/passwd | awk 'BEGIN {FS=":"; OFS=" ";} {if ($1 == "qmaill") {print $1,$3,"\nroot 0"} else {print $1,$3}}' > conf-users
     # grep -E '^(qmail|nofiles)' /etc/group | awk 'BEGIN {FS=":"; OFS=" ";} {print $1,$3}' > conf-groups
  4. Configure linker flags (inside Qmail source directory after patches are applied):

    # pkg-config --libs openssl > ssl.lib
    # echo "/var/qmail" > conf-qmail
    # echo -lssl > ssl.lib
    # echo "/var/qmail" > conf-qmail
  5. Now you can run make\.

  6. After compilation, you should NOT overwrite all existing Qmail files with new ones, i.e. do not run make install. Installed configuration files and init script should remain untouched. Instead, only needed Qmail binaries should be replaced with new compiled ones:

    • Stop Qmail and DrWeb services from Plesk (not from shell!).
    • Stop xinetd(inetd) service from shell.
    • Replace files according to your Plesk version:

      • For Plesk 8.2: copy compiled qmail-queue, qmail-remote, qmail-local into Qmail bin/ directory plus make their copies with .origin suffix, for example:

        # cp qmail-queue /var/qmail/bin/qmail-queue
        # cp qmail-queue /var/qmail/bin/qmail-queue.origin
        # cp qmail-local /var/qmail/bin/qmail-local
        # cp qmail-local /var/qmail/bin/qmail-local.origin
        # cp qmail-remote /var/qmail/bin/qmail-remote
        # cp qmail-remote /var/qmail/bin/qmail-remote.origin
      • For Plesk 8.3 and above: copy compiled qmail-queue, qmail-remote, qmail-local into Qmail bin/ directory with .moved suffix (do NOT replace current files!), for example:

        # cp qmail-queue /var/qmail/bin/qmail-queue.moved
        # cp qmail-local /var/qmail/bin/qmail-local.moved
        # cp qmail-remote /var/qmail/bin/qmail-remote.moved

        NOTE: Remember to restore original owners/permissions for the files replaced. Because files owners/permissions may differ on different operating systems, we cannot provide exact commands. Before replacing the binaries remember original owners/permissions and restore them afterwards.

    • Start xinetd(inetd) service
    • Start Qmail and DrWeb services.

Additional Information

NOTE: Before starting the recompilation, it is recommended that you learn original Qmail documentation for specification of the recompilation procedure.

NOTE: For Plesk version 9.5, you may use patches plesk93_qmail_patches.tgz and the same compilation instructions.

Search Words

How to compile Qmail with custom patche


a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 56797cefb1efc9130f7c48a7d1db0f0c e8756e9388aeca36710ac39e739b2b37 dd0611b6086474193d9bf78e2b293040

Email subscription for changes to this article
Save as PDF