Cloning your Debian Install

Sometimes you need to reinstall a Debian system. Maybe your hard drive is going pear-shaped, maybe you got a new computer, maybe you are replicating a system, maybe you are building a lab. In any case, if you want all the packages that are installed on system 1 on your new/other system 2, here’s an easy way:

  1. On system 1, make a file with your installed/removed packages: dpkg --get-selections > packages.txt
  2. Get a base install done on system 2, and set /etc/apt/sources.list to be the same as on system 1
  3. Get packages.txt onto system 2
  4. Run dpkg --set-selections < packages.txt on system 2
  5. Run dselect install on system 2
  6. Optional: Dance