Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Language: German English

Building a nginx debian package with third party modules

Ich habe diese Anleitung mit Debian Squeeze (amd64) und der neusten Version von Nginx (stable) mit einem Third Party Module als Beispiel erstellt. Bitte beachtet, das ihr ggf. die Versionsnummern in dieser Anleitung anpassen müsst, wenn ihr neuere Versionen von Nginx oder des Moduls verwendet.

1. Installation Debian Build-Tools und abhängigen Paketen

aptitude install build-essential dpkg-dev debhelper autotools-dev libgeoip-dev libssl-dev libpcre3-dev zlib1g-dev

2. Herrunterladen und entpacken des neusten Nginx

wget http://nginx.org/download/nginx-1.0.2.tar.gz
tar xvzf nginx-1.0.2.tar.gz

3. Weitere Module herrunterladen

In diesem Beispiel verwende ich das Nginx Proxy Purge Modul. Herrunterladen

wget http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz

und anschließend ein Verzeichnis “module” erstellen (sollte dieses nicht bereits existieren). Das Modul wird dann in dieses Verzeichnis entpackt:

mkdir nginx-1.0.2/modules
tar vfx ngx_cache_purge-1.3.tar.gz -C nginx-1.0.2/modules/

4. Herrunterladen des neuesten Debian Pakets

apt-get source nginx

Man bekommt einen Ordner mit den letzten Debian Sources angelegt (nginx-0.7.67) von diesen wird jedoch nur der Ordner “debian” benötigt.

5. Kopieren des Debian-Ordners in den neuen Nginx-Ordner

cp -r nginx-0.7.67/debian/ nginx-1.0.2
rm nginx-1.0.2/debian/patches/*

Nicht vergessen die alten Patches zu entfernen! Diese werden nicht mehr benötigt.

Edit “nginx-1.0.2/debian/changelog” and prepend:

nginx (1.0.2-1) unstable; urgency=low

  * added purge proxy module

 -- Sebastian Mogilowski   Sat, 14 May 2011 13:00:00 +0100

Bemerkung: Am besten ersetzt man dabei meinen Namen durch seinen eigenen :-)

Nun fügt man das Modul zu den Build-Rules hinzu. Dazu editiert man die Datei “nginx-1.0.2/debian/rules” und fügt

--add-module=$(CURDIR)/modules/ngx_cache_purge-1.3 \

zu den “./configure” Einstellungen.

Beispiel:

./configure --conf-path=/etc/nginx/nginx.conf \
            --error-log-path=/var/log/nginx/error.log \
            --http-client-body-temp-path=/var/lib/nginx/body \
            --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
            --http-log-path=/var/log/nginx/access.log \
            --http-proxy-temp-path=/var/lib/nginx/proxy \
            --lock-path=/var/lock/nginx.lock \
            --pid-path=/var/run/nginx.pid \
            --with-debug \
            --with-http_dav_module \
            --with-http_flv_module \
            --with-http_geoip_module \
            --with-http_gzip_static_module \
            --with-http_realip_module \
            --with-http_stub_status_module \
            --with-http_ssl_module \
            --with-http_sub_module \
            --with-ipv6 \
            --with-mail \
            --with-mail_ssl_module \
            --add-module=$(CURDIR)/modules/ngx_cache_purge-1.3 \
            $(CONFIGURE_OPTS)

6. Erstellen des Pakets

cd nginx-1.0.2
dpkg-buildpackage -b

7. Installation

dpkg -i nginx_1.0.2-1_amd64.deb

, ,

3 Responses to “Building a nginx debian package with third party modules”

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.