Plesk uses patched Qmail. How to compile Qmail with custom patches?


2016-11-16 13:15:43 UTC


2017-08-16 17:18:22 UTC


Was this article helpful?

Have more questions?

Submit a request

Plesk uses patched Qmail. How to compile Qmail with custom patches?

Applicable to:

  • Plesk 10.x for Linux


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 213393589 .

  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
  1. 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,"\

root 0"} else {print $1,$3}}' > conf-users # grep -E '^(qmail|nofiles)' /etc/group | awk 'BEGIN {FS=":"; OFS=" ";} {print $1,$3}' > conf-groups

  1. 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
  2. Now you can run make\\ .

  3. 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:

  4. Stop Qmail and DrWeb services from Plesk (not from shell!).

  5. Stop xinetd(inetd) service from shell.
  6. 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.

Have more questions? Submit a request
Please sign in to leave a comment.