Debian – How to clone a Debian system? (ie. deploy via template)

clonedebiandebian-squeezedeploymenttemplate

I'm running ESXi 5.0 and have created a Debian Squeeze (6.0.5) "template" system which is just an installation of Debian slightly customized (ie. VMware Tools installed).

If I clone the system (ie. deploy it to a new virtual machine) then I need to perform several actions:

  1. Change hostname
  2. Regenerate SSH keys

Is there an easy method to perform the above actions? Changing the hostname is particularly a problem because according to (http://wiki.debian.org/HowTo/ChangeHostname) you must change it in several files such as the exim configuration, ssmtp, etc).

Is there an "approved" or easier method of doing this?

Best Answer

Don't clone. Instead, learn configuration managament and unattended installs.

Install your debian systems with pxe and a preseed file for debian-installer. That should set up a base system. Then use puppet or chef to manage all configurations.

No need for cloning, and you can manage your servers better.