I have a few servers (10) running Debian Lenny on x86. I need to compile some packages from source. I know it is not a good practise to have compilation tool on a production server (for security).

I want to know, if I can compile those packages on a single computer (x86) and just install them on the servers ?

Is there any problem ?

Examples of packages

  • kernel-source
  • Apache
  • PHP5
  • ...

Thank you a lot.


You have ten Lenny servers all running the x86 arch. It's completely possible to build a single package that installs to any computer running a specific arch. It's good practice to build Debian packages with pbuilder, to avoid any "works on the dev box" problems.

It's relatively simple to rebuild a package. apt-get has a source command that will pull down the source code. If all that's needed is a simple configure options change then you're nearly set. Edit the debian/rules file, and version bump the package with something like ~jldugger0, so you override the debian version you derived from, but not anything newer from Debian. Just increment the trailing 0 to keep bumping local versions. Do not bump the Debian version directly, and for god's sake, DO NOT BUMP THE EPOCH--if you want to ensure that newer versions don't override local changes, pin the package. Be aware that you're incurring substantial security risk and need to find some way to subscribe to changes in the package for review.

The two problems with local versions of packages are: effort should be taken to keep pace with new versions. If your change is simple enough you might be able to get by with a script that applies patches. If it's invasive, not pushing changes upstream will cost you greater and greater amounts of time as conflicts accumulate. The other problem is that of dependencies. The kernel, Apache, and PHP are all core components that other packages depend on. Consider whether the changes you want to make to a package will affect other packages depending on it.


As long as the servers are from the same distribution (and have same platform, x86), compiling on one of them and installing on several should make no difference. It would be as good as getting pre-compiled binaries or a package itself.

Infact, you could also package (or just tar.bz2 the compiled directory, take it to each server, extract locally and run make install there.

Once the install completes, just delete the extracted directory from those servers.


If the architecture is the same, then it will be quite straightforward. If not, then it's called cross compile and needs a bit of setup.

Maybe an idea would be to setup an internal debian repository for custom packages. That way the package will be available to your servers via apt (as long as they know about your custom repository)


You could:

  • As others have answered, compile them into packages (or tar files) and copy across and install them,
  • Compile them all on one server, install them into a shared directory and NFS mount it (/usr/local or /usr/share both come to mind). This won't work for kernel images, obviously.

You can also use the make-kpkg command to make .deb packages which will be very similar to what you can find in standard repos.

  • Just to clarify: make-kpkg is for making .debs of kernels only. (You get make-kpkg by installing kernel-package.) – Telemachus Jun 16 '09 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.