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

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.


I haven't tried clonezilla myself, and I hardly know how it works, but what I've been told so far is that you should be able to make an exact copy of your system, and I guess you should be able to install the copy as well.

you can read about Clonezilla here