Do you use let's encrypt?





5848 votes ~ 21 comments

 

Building a Debian package for the latest version of nginx

Posted by kveroneau on Mon 21 Mar 2011 at 10:32

As Debian Lenny has a really outdated version of Engine X available, I took some time to update the package and compile it and note how it is done here for future references to anybody who needs to update an existing Debian package to use themselves.

Start by creating a directory to source your source files, lets call it $HOME/src

In this directory, run "apt-get source nginx" to download the Debian source code of the package.

After that as root, download all the building deps by running: "apt-get build-dep nginx".

Still as root, download some extra packages we'll need: "apt-get install build-essential fakeroot".

Exit the root shell and go back to your account where you downloaded the source.

Now for the fun part, downloading the latest version of Engine X and Debianizing it.

Use wget or just download the package using your browser, save and extract the source in your $HOME/src.

This will create a folder with the latest Engine X source code. Enter the directory and run:

cp -av ../nginx-0.6.32/debian ./

This will copy the "debian/" subdirectory from the source we fetched with apt-get into the directory we've just unpacked the newer version of nginx into.

Now lets edit the debian control files to update the version and change the configure options.

First edit debian/changelog and add the following to the very top:

nginx (0.8.53) unstable; urgency=low

  * Compiling new version into debian package.

 -- Kevin Veroneau <kveroneau@testing>  Wed, 8 Sep 2010 12:45:27 -0600

(Obviously edit the information to suit your needs.)

The next file we need to edit is: debian/control, just update the maintainer and uploader to your own information.

Almost done, now edit the file debian/rules and change the configure options to suit your sites needs.

Feel free to edit any of the default configurations under debian/conf/ before running the final command.

The final command which will build the package into a DEB file using the updated source code is:

dpkg-buildpackage -us -uc

After running this command, the build process will start and create a nice DEB package in the parent directory. Be sure to run this command in the $HOME/src/nginx-0.8.53 folder. There is no need to run ./configure or make, as this program does everything for you.

I may at one point make a videocast on YouTube with the full process, as Engine X does compile very fast.

Happy package updating! Just remember to check for Security advisories, as this package will not update itself.

 

 


Re: Building a Debian package for the latest version of nginx
Posted by Anonymous (193.144.xx.xx) on Mon 21 Mar 2011 at 10:46
Why not start from the latest debian package? It should have new patches addressing security flaws or bugs. The older debianization may even not compile with newer versions of nginx.

Go to the QA page of nginx in Debian:

packages.qa.debian.org/n/nginx.html

In "versions", copy the link to the latest version, 0.8.54-4. Use the link to download the source:

dget link_to_nginx_0.8.54-4.dsc

Enter the directoty and just compile:

dpkg-buildpackage -j4

Install the debs with dpkg. Enjoy :)

[ Parent | Reply to this comment ]

Re: Building a Debian package for the latest version of nginx
Posted by Steve (82.41.xx.xx) on Mon 21 Mar 2011 at 11:45
[ View Steve's Scratchpad | View Weblogs ]

That is how I proceed.

I had to backport nginx for Lenny to get the IPv6 support which is needed upon this host.

Steve

[ Parent | Reply to this comment ]

Re: Building a Debian package for the latest version of nginx
Posted by kveroneau (24.78.xx.xx) on Mon 21 Mar 2011 at 17:24
Thank you Anonymous. I never knew about that website. It does provide 0.8.54 in unstable. I currently use 0.8.53 as I do not require the new features of 0.8.54, and it may have introduced new bugs.

An advantage to downloading the source package directly from the developer, is for people who prefer a vanilla version of a package. Also some third party modules for nginx may not compile without a vanilla version, or sometimes even a specific version of nginx.

---
Kevin Veroneau
http://www.chronoboy.com/
http://www.kveroneau.info/

[ Parent | Reply to this comment ]

Re: Building a Debian package for the latest version of nginx
Posted by Anonymous (88.13.xx.xx) on Mon 21 Mar 2011 at 19:31
Hi Kevin,

in order to get a "vanilla behaviour", you can enable and disable Debian's patches at will easily by just deleting lines in debian/patches/00list or in the quilt stack in new versions. Remember that in 99% of the cases, modifications to the source code are contained in the patches, so even if you replace the code by the version you want, you are patching it anyway, so you stray from the "vanilla" version (see patch-tracker.debian.org/package/nginx/0.8.54-3)

Anyway, I found your article inspiring.

[ Parent | Reply to this comment ]

Re: Building a Debian package for the latest version of nginx
Posted by olden (2001:0xx:0xx:0xxx:0xxx:0xxx:xx) on Wed 6 Apr 2011 at 14:48
[ View Weblogs ]
Well. And, you can try to use existing building: For Lenny:
deb http://ftp2.debian.org.ua/debian-dou/ lenny main
For Squeeze:
deb http://ftp2.debian.org.ua/debian-dou/ squeeze main
Sign:
$ wget -q -O - http://ftp2.debian.org.ua/debian-dou/archive.key | sudo apt-key add -

[ Parent | Reply to this comment ]

Re: Building a Debian package for the latest version of nginx
Posted by Jevad (88.131.xx.xx) on Mon 18 Apr 2011 at 14:23
nginx is now in dotdeb package

[ Parent | Reply to this comment ]