Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a reliable way to bootstrap new Debian servers with customly pre-built software. For example, I need to have a specific version of PHP built from sources with optimized options, nginx, Percona server and so on. Currently for each new server I'm doing it manually which is really boring.

I'm starting to think on how to automate this process. Of course, there are solutions like Chef, Puppet, cfengine but they all look pretty complicated and fragile to me. I need something really dead simple and proven. Since I'm using Debian based servers I'm thinking about packing all the required software into one .deb file. This way all I'll have to do is just install it and should require all the dependencies, setup config files, execute post install hooks and so on.

What do you think about it? Is it a good idea?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

(Obligatory link to where I wrote up my experiences)

If it were me, I'd split up the tasks and let different tools handle each stage:

  • Debian-installer with preseed to get the disks formatted, the bare OS loaded, and some kind of configuration management software installed.
  • Let the configuration management software take care of the rest of the package installations and configuration.
  • Make sure you have .deb versions of any custom software you want installed, put them on an accessible web, ftp, or ssh site, and install those via the configuration management software.

Honestly, I'd rethink your position on Puppet (and maybe Chef, but I wouldn't recommend cfengine -- I looked at it in 2007 because I thought it would be easier to get running on Solaris. But as soon as I saw Puppet was comparably easy to set up, I tossed cfengine aside).

You don't have to hand everything over to configuration management software, just what makes sense.

  • If all you want Puppet to do is to keep an Apache config file in sync from a master copy, and restart the httpd process anytime you make a new version, it'll do it.
  • If you want to ensure that all servers in a particular class have a particular set of packages installed, and be able to change that set in one place and have all those servers install the packages you added to the list, it'll do that, too.

If you wanted to optimize on the least initial pain, then

  • Make individual packages for PHP, nginx, etc. and put those in a .deb repository. I can't see any reason to make one giant package.
  • Use Debian-installer with preseed to install the base OS plus your custom packages at install time.

For making your own deb files, there are at least two options. Both require appropriate deb-src entries in /etc/apt/sources.list:

  1. Take the current version of the package from your release, modify its build procedure, and then rebuild.
  2. Take the current version from testing or unstable, optionally modify its build procedure, and then rebuild.

For option 1, you should be able to do apt-get build-dep somepackage; apt-get source somepackage to get the build dependencies and sources to any package in your current release. Head into the source folder for the package, and edit debian/rules with your configuration changes. Edit debian/changelog to bump the version number higher and add your notes. Then run dpkg-buildpackage to build the new binaries and sources.

For option 2, it's basically the same procedure, except that the build dependencies may be more complicated to satisfy. Testing or unstable may have a newer version of Boost, glibc, or whatever. Sometimes a package will depend on those newer versions that you don't have. Sometimes you can remove the version number requirement from debian/control and build without problems. If that doesn't work, then you have to recursively port the build dependencies back to your release.

There's also a chance that your package is already in Debian's backports repository, in which case, you get a newer version of a package ready to install (or modify and rebuild) on your current release. For example, Debian lenny has nginx 0.6.32, but lenny-backports has 0.7.67. Squeeze has 0.7.67, but there's no nginx for squeeze-backports at all.

share|improve this answer
    
Thanks a lot for your recommendations! What I don't like about Puppet/Chef is the fact it should be installed and configured as well. But in case of preseeding this should not be a problem(very nice tip). As for individual .deb packages for each piece of software, do you happen to have any links on good tutorials on this? –  pachanga Apr 29 '11 at 19:21
    
The client-side configuration of Puppet (and I guess Chef, too) is awfully simple. In my documented case, just one /etc/default/puppet file copied out. There are other ways of doing it, too, but that was the easiest at the time. As for the other question, I'll edit my answer. Otherwise, I'll run out of room. –  Mike Renfro Apr 29 '11 at 19:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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