Patching Apache on Debian

Steps for applying a patch to the Apache source tree and building a Debian package of the patched Apache in order to install via apt as normal.

  1. Download the source package and build dependencies:
  2. apt-get source apache2
    apt-get build-dep apache2
  3. Apply the patch to the source:
  4. cd apache2-2.2.9/
    patch -p1 < patchfile
  5. Build the debian package:
  6. dpkg-buildpackage -uc -us -b
  7. List the currently installed apache2 packages:
  8. dpkg -l | egrep '^i+ +apache2'
  9. Install the appropriate newly built packages (all the packages listed in the previous step) and restart apache:
  10. cd ..
    dpkg -i apache2_2.2.9-10+lenny2_all.deb
    dpkg -i apache2-mpm-prefork_2.2.9-10+lenny2_amd64.deb
    dpkg -i apache2-prefork-dev_2.2.9-10+lenny2_amd64.deb
    dpkg -i apache2-utils_2.2.9-10+lenny2_amd64.deb
    dpkg -i apache2.2-common_2.2.9-10+lenny2_amd64.deb
    
    apache2ctl restart

Simples!

2 Comments

  1. R S Chakravarti
    Posted June 13, 2009 at 1:13 pm | Permalink

    You didn’t write anything about the patchfile. Where to get it? How do we know we can patch the Debian source with it?

  2. Posted June 13, 2009 at 1:25 pm | Permalink

    The patchfile is whatever patch you want to apply to Apache, I was merely explaining how to apply such a patch in a Debian environment – which patchfile(s) you use depends why you need to patch Apache. If you don’t have a specific patch you need then you should be fine with the standard Debian install.

One Trackback

  1. By How do I patch apache? - Admins Goodies on April 14, 2012 at 1:33 am

    […] Source: https://base6.com/2009/06/07/patching-apache-on-debian/ […]