Well, I know a way to record what packages you have now and then restore them later, but it won't backup config files. If you want to backup everything, use dd, g4u, or partition image.
Otherwise do the following
Code:
dpkg --get-selections > myselections.txt
Save that text file somewhere, as well as your sources.list.
Then to restore it, copy your sources.list to the machine and do
Code:
dpkg --set-selections < myselections.txt
apt-get update
dselect update
apt-get dselect-upgrade
This should install all the programs you had installed on the machine before, but you'll have lost the config files unless you back them up separately...