Building metapackages to make installations easier September 29, 2009

At the Digital Tool Company, I have gone through a series of strategies to manage installing new machines, or upgrading old ones.

I’ve been installing Linux since the days of Red Hat 7.2. And the Digital Tool Company (nee O S S Africa) “standard desktop” has moved through Red Hat, Mandrake, Debian, and now sits at Ubuntu and Kubuntu. (There have been forrays into other distros. In fact, I’m typing this on Linux Mint right now (which is very nice, by the way.))

Our first strategy was just to install everything, and copy config files from a machine that was already set up.

Then I made drive images, by installing one machine Just Right, and then copying its drive. Then I’d make a little change, and feel the need to copy the image again. And repeat, until I had wasted vast amounts of time, and annoyed myself.

Then I made a PXE boot image, and created PXE boot disks. Luckily at that stage our machines all used Realtek 8139x network cards, because boot disks can be a bit of a pain.

Now I just use the Ubuntu installation CDs, either the “Desktop” or “Alternative”. After the initial installation, I install a metapackage that has all the extra stuff we use. There’s more to the story, but I’ll cover that in my next post.

What I want to tell you about here is how easy it is to create a metapackage. The benefit is that you can have one metapackage for each distro you want to support, and they are simple to maintain.

First, create a directory for your package. In this example I’ll call mine “dtc-mint-desktop_1.0_i386″. And create a directory called “DEBIAN” inside it.

$ mkdir -p dtc-mint-desktop_1.0_i386/DEBIAN

Next, create a file in the DEBIAN directory called “control”. (If you have done this before, and you want to pull out the control file from a metapackage you’ve already created, use the command “dpkg-deb -e dtc-mint-desktop_1.0_i386.deb dtc-mint-desktop_1.0_i386/DEBIAN”).

$ nano dtc-mint-desktop-1.0_i386/DEBIAN/control

Make it look like this:

Package: dtc-mint-desktop
Priority: optional
Section: metapackages
Maintainer: YOUR NAME <YOUR@E-MAIL.ADDRESS>
Architecture: i386
Version: 1.0
Depends: apache2, auth-client-config, autofs, autofs-ldap, directoryassistant, firebug, firefox-webdeveloper, krb5-user, libapache2-mod-php5, libapache2-mod-python, libnss-ldap, libpam-ccreds, libpam-krb5, libpam-ldap, mailx, msttcorefonts, mysql-client, mysql-server, nfs-common, nscd, ntp, php5, php5-gd, php5-mysql, php5-xsl, php-doc, phpmyadmin, php-pear, postfix, python-django, python-mysqldb, quicksynergy, ssh, ssh-askpass, subversion, sunbird, sun-java6-fonts, synergy, thunderbird-gnome-support, thunderbird-quickfile, vim-gnome, xulrunner-1.9-venkman
Description: Linux Mint desktop system specifically for DTC requirements
It is safe to remove this package if some of the packages are not desired.

Customize the file to suit your requirements. These are just the packages we use, and in this example they exclude the stuff already included in a fresh installation of Linux Mint 7 Gloria Main Edition.

When you’re done, you’re ready to build! The files in packages should be owned by root, so first let’s set the permissions:

$ sudo chown -R root.root dtc-mint-desktop-1.0_i386/

And then we’ll build the package:

$ dpkg-deb -b root.root dtc-mint-desktop-1.0_i386/ dtc-mint-desktop-1.0_i386.deb

That’s it! Next time you want to install your favourite bunch of packages, do a clean install of your distro, and install this package with “dpkg -i”, followed by “apt-get -f install” to satisfy dependencies:

$ sudo dpkg -i dtc-mint-desktop-1.0_i386.deb
$ sudo apt-get -f install

In my next post, we will take a look at our installation script.

Leave a Reply