How do I duplicate a server's packages and configuration to another machine?

dpkg --get-selections > packlist.txt  
cat packlist.txt | dpkg --set-selections  
dselect install  

For details on this command, check here on joys of programming

If you need the same users and passwords you should grab /etc/group /etc/passwd and /etc/shadow

If you need the user data you need to copy /home (it's usually HUGE, so it was left out of the original post)


Install aptoncd.

sudo apt-get install aptoncd   
aptoncd

Select the packages, create iso, take to other machine, install aptoncd, and then restore from iso.