0

This is something that has been bugging me for a while, unable to find any good answers googling, hopefully someone can have a solid answer here.

It's about how to rebuild debian packages and how to maintain them.

First, how would I install NGiNX with enabled non-default modules. I assume it's as simple as to downloading the package source, editing something, rebuild it, and install it. But how do you do it, step by step.

Second, once you have a rebuilt package installed, what if a newer version of NGiNX is released, and you want to upgrade it by running a simple "apt-get upgrade" command. Would it do it or do you have to redownload and rebuild the package? Also, if it doesn't work like that, how do you make it work like that?

Someone please give a clear answer. THanks so much!

2 Answers 2

1

Specifically with Nginx, you will pass the configure script specific parameters as noted here.

A new version of Nginx means you will have to download the source and rebuild and install it again, each time. Once you build from source, your package manager has nothing to do with that package. This is almost a non-issue for you, though, because Debian moves at the speed of erosion. The brand-new source release today won't be in the Debian repositories any sooner than half a year from now.

Yes, this entire building-from-source business is a can of worms. It means that the nice startup scripts that Debian includes won't apply to your custom build of Nginx, and there will be a bit of reverse-engineering to get it to work right.

Do you need the absolute latest Nginx with special compile-time options, or can you settle for a version from Dotdeb?

If you absolutely, positively insist on building your own Nginx, at least turn it into a Debian package so you can reuse your custom build. Here are some instructions. There are a bunch of people that are way better at packaging software for Debian. Use their packages. Don't make your own.

UPDATE: Read this changelog for Nginx 1.2.3. They link to this spreadsheet where it indicates that the nginx-extras package offers MP4 module support.

6
  • I do plan on using the dotdeb packages for nginx. But I think the MP4 video streaming and some other models are not enabled by default. I assume I would need to download dotdeb's package source and rebuild it with the modules enabled? 1) How do I do that, and 2) what happens when dotdeb releases a new version of nginx and I run a apt-get to update my packages, which ends up writing the latest release of nginx with the required modules enabled over the previous one. Right? Aug 8, 2012 at 0:31
  • Check updated answer, looks like you need the nginx-extras package from Dotdeb Aug 8, 2012 at 0:35
  • Where can I found out which modueles are included and enabled in dotdeb's nginx-extras, nginx-full, nginx-light, etc. packages? Aug 8, 2012 at 1:41
  • Check out the spreadsheet I linked Aug 8, 2012 at 1:44
  • Completely missed that. Thanks for your answer. It helped me so much! Aug 8, 2012 at 1:51
1

Joel mentions some good alternatives to building a Debian package which you should seriously consider, since they are most likely a better fit. However, to answer your question directly, there are a few ways to go about it.

First, you could compile and package the software from scratch. This is a complicated process, and probably not what you want to do, but if so, check out the Debian New Maintainers' Guide.

Second, you could unpack the existing package, modify the source and build environment as needed, rebuild and repackage. This is fairly simple, though full of potential hazards. The steps are, generally,

  1. Install the build-essential package, which has the tools needed to build Debian packages.

  2. Download the package source by running apt-get source nginx, or whatever package name is appropriate. This will download and unpack the source package, including any patches, in a format ready to repackage. You may need to add or uncomment the deb-src configuration lines in /etc/apt/sources.list for the appropriate section of the repository.

  3. Install the appropriate build dependencies with apt-get build-dep nginx.

  4. Make your modifications. Referring to the New Maintainers' Guide is helpful here, since the build will be automated, and may undo some of your changes. Be sure to increment the build version so that your package can be installed over the existing one.

  5. Build the package with dpkg-buildpackage -b. The -b flag tells dpkg that you don't want to regenerate the source package.

  6. Install your package.

An easier approach is to use the checkinstall program, which generates a Debian package by running an installation command and making a package that reproduces the changes that command made. This works for many software packages, and is fairly straightforward:

  1. Download the source code and make your modifications as needed.

  2. Build the project as you normally would (make, for instance, but not make install).

  3. Run sudo checkinstall -D make install. You can modify this for a different installation command if necessary (python setup.py install for Python projects, for instance).

  4. Follow the interactive prompts to build the package. Knowledge of Debian packaging conventions is helpful to make a useful package; you'll have to copy dependencies from the existing package, for instance.

One final approach is to use Alien to convert an existing package (RPM, Slackware tgz, etc) to a .deb package. I have not used this approach myself, and it requires an existing package that meets your needs in terms of compile-time configurations.

These options should all work for Debian or Ubuntu, but I've only tried them on Ubuntu.

1
  • Good "hands-on" summary of the build process, including link to the maint-guide.
    – dsh
    Aug 8, 2012 at 1:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .