To back up existing state:
Back up package selections:
dpkg --get-selections > dpkg_selections.Back up the debconf database:
sudo debconf-get-selections > debconf_selections.
To apply this to a new system:
First apply debconf selections with:
sudo debconf-set-selections < debconf_selections.Apply package selections:
dpkg --set-selections < dpkg_selections.Install packages:
apt-get dselect-upgrade.
Your data should primarily be in /home and /var (e.g., /var/lib/mysql for MySQL, /var/www for Apache, etc.). Figure out which applications are important to you.