Package List Cloning

From Granizada

Jump to: navigation, search

Cloning a computer (real or virtual) can be done at several levels. You can duplicate disk images. You can run a system like FAI (Fully Automated Installation) which guarantees that a machine is installed from scratch in a known way. But sometimes you just want to have the same packages installed on two machines, although the ways the packages are configured might differ or there may be different hardware. This is what I refer to as cloning the package list.

If you use cloned package lists for a group of machines, these machines will not be identical. It is not, for example, a way of creating a Standard Operating Environment (SOE) for your servers, to use a term big companies love. However it is a good way to ensure that you have a set of packages you are comfortable with, but not the huge mass of packages you get from the standard installation options of any of the distributions. With servers, starting from a minimal base and adding things when you need them is a good way to avoid trouble later, but if you start to minimalist you can spend a lot of time just adding packages.

The following recipe will work for for any Linux distribution that supports apt and dpkg. (You can do something similar with rpm -qa creating an install list for yum, with a little text manipulation.)

On the machine whose package mix you like, go:

 dpkg --get-selections > debiansmyhero

Then do an ultra-basic install on the machine you want to more-or-less look like this one and then go:

 dpkg --set-selections < debiansmyhero
 apt-get dselect-upgrade

Job done. There is plenty of scope for these machines differing, including human error (most likely the dselect-upgrade above will ask you questions whcih you may answer differently on different machines.)

If you have just one or two packages you roll yourself (because the repository maintainers don't do it quite the way you like, eg enabling all possible modules, or because you have a nice little set of scripts you have written, etc) this might be a good time to work out how to put those debs in your own little repository.

Personal tools
Navigation