Simplifying Ubuntu Deployment with Custom Metapackages

I think being a good sysadmin requires a special combination of conscientiousness, industriousness, and laziness.  In the past, I’ve never quite had the right mix, I’ve been trying to change that though.  Most of the Ubuntu Linux systems we’ve deployed at work have been one-offs — One of the developers or I fired up a machine or virtual machine with an Ubuntu install CD and stopped once we had the machine doing whatever we needed it to do.  I simplified the process a little by saving a copy of a freshly created VM that I could reuse, but that still takes a bit of manual labor.  

When we started deploying virtual machines for deploying production and staging versions of our apps at an outside hosting provider, I decided it was time to up my game.  The virtual machines are provided with a very basic linux installation.  I scripted as much of the basic system configuration as possible, and was careful to update my script when I made a change or addition.  That helped considerably, when I brought up a second machine, but now that I’m about to do a third, I feel the need to go even further.

I’ve decided to take the approach of creating “metapackages” to handle the installation most of the required pieces. After that, I plan to create some basic packages for a few of the things that we are compiling from source.  I’d also like to figure out how best to automate the further configuration of some of the packages.

Ubuntu Linux is built on top of Debian Linux and it uses, apt (Advanced Packaging Tool), Debian’s packaging, system to manage software installation, maintenance, and removal.  Packages can contain binaries, configuration files and scripts, source code, documentation, etc.  They also define relationships with other packages, such as whether they depend on another package, what functions they make available that might satisfy dependancies of other packages, whether they are a replacement for some other package, etc.  Apt takes advantage of this information to make sure everything that needs to be installed gets installed, and doesn’t conflict with other pieces.  It’s this dependancy management that I’m going to take advantage of first.

A vast number of volunteers in the Ubuntu and Debian communities have done the hard work of packaging thousands of pieces of open source software for easy installation.  They’ve found the source code, they’ve figured out all the dependancies, they’ve considered important use cases to come up with useful default configurations.  They’ve tested things to make sure they work as expected, created patches if they don’t, and they update the packages when new versions of the packaged software is released or bugs are patched.  I’m going to take advantage of all their hard work by creating “metapackages,” which just specify all the existing packages I need to install.

Figuring out the best way to go about creating metapackages is a job in and of itself.  If wouldn’t be Linux if there weren’t at least 4 different ways to do things, and creating debian packages is no different. With some digging though, I found this post on the Ubuntu forums, which pointed to the “equivs” package, which was helpful, because it’s not mentioned in the Ubuntu Packaging Guide.  Armed with that clue, I found a nice looking HOWTO on the Ubuntu forums for creating metapackages with equivs.  It looks like it even covers one of my next steps, which is to handle custom configuration of the installed packages.

For now though, I’m headed outside to work in the yard since we got a break in the rain.  I plan on posting a followup once I’ve had a chance to try putting what I’ve learned into practice.

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>