Sometimes when you're building a system, you want to be able to close the list of packages that are installed on another system.
Debian provides some great utitlities to manage their packaging system (apt, synaptic, etc). They also provide the dpkg suite of utilities as well. In this case, the command:
will return a list of packages that are currently installed on the system.
Likewise, their is a related command to set the selections on the target system. This is:
NOTE: This does not perform the actual installation!
You can now run dselect to start the installation with the packages you've selected and install the packages you want.
If you need to copy the list of files from one system to another, the exact steps are:
On system one (the source system you are cloning)
dpkg --get-selections > /tmp/packages.lst
Now connect to system two.
Perform a base install and select just a basic system. Make sure you install, as part of the basic system, the ssh packages if you are going to copy the file over a network from system one.
On the second system, run the following command:
scp user@computer:/tmp/packages.lst .
Notice the final character, the period, that means to copy the files from the remote system to the current directory on the local system.
Now run the command:
dpkg --set-selections < ./package.lst
Now running the command dselect will display the packages you've selected. Follow the menu prompts to perform the actual install. While you shouldn't have to reboot, this is a good time to reboot since you want to ensure all your services start up in the correct order and all the dependenices are solved.
Once the system comes up, don't forget to apply ALL security patches.