Cloning a Debian server

From IridiaWiki
Revision as of 19:19, 20 February 2006 by Christensen (Talk | contribs)

Jump to: navigation, search

Cloning a server an be necessary for various reasons, e.g. due to hardware failures and upgrades as well as after hacker attacks. Notice that in order to clone a server using the method described below, you need access to the server that you want to clone. Hence, it is a good idea to take the steps described below BEFORE a machine crashes or is compromised.

The cloning consists of four different steps:

  1. Installing the correct packages
  2. Cloning the configuration
  3. Copying all user files
  4. Loading all application data (databases, mail, etc.)


Installing packages

On the server that you wish to clone, you have get a list of installed packages:

$ dpkg --get-selections > packages_server.txt

The machine on which you want to install the server clone has to be up and ready to receive a Debian fresh installation. Find a Debian installation image and install a minimal system. Get a list of all the packages installed on the new minimal system:

$ dpkg --get-selections > packages_minimal.txt

Now, change all occurances of "install" to "deinstall" on packages_minimal.txt, except hardware specific packages (e.g. for usb keyboards, network devices etc.).

Copy the file containing the package selections for the server (packages_server.txt) to the newly installed system and:

$ cat packages_minimal.txt | dpkg --set-selections 
$ cat packages_server.txt | dpkg --set-selections 

This will selected the packages that were selected on the server you want to clone as well as remove any unwanted packages from the minimal install. In order to actually install the packages run:

$ dselect

And choose "Install". Don't worry too much about the various configuration options as you are likely going to overwrite during the configuation cloning.

Cloning the configuration

User files

Restoring application data

Personal tools