How to Clone a Debian Install

Although it is insanely easy to install software on Debian systems using the package manager, there is a neat technique that you can use to clone a PC or reinstall all your software with one command after a format. This works with all Debian-based systems.

First, run this command:

dpkg --get-selections

You will see that the above command outputs all the packages that you have installed on your machine. Let’s put that in a text file and save it for later.

dpkg --get-selections > ~/packages.txt

Now we have that same output you just saw sent to a text file in your home folder. Save that file if you are going to wipe your system, or copy it to the computer you want to clone.

Now, to restore it, just make sure that you have that packages.txt file in your home directory, and run this command:

sudo dpkg --set-selections < ~/packages.txt && sudo apt-get dselect-upgrade

Wait for that last command to finish, and you should be set.

This entry was posted on Tuesday, September 4th, 2007 at 12:47 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply