To sycnronise package installs from one debian (or other deb-packaged) system to another use:

dpkg --get-selections

to build a list of the package selection states on the 'source' system. This generates a two-column output which will mostly show "install" packages but you will most likely find other entries such as "deinstall" for packages that have be uninstalled but not purged:

source-server# dpkg --get-selections | tee dpkg-get-selections-ouput-from-source-server
python                                          install
python-appindicator                             install
python-apport                                   install
python-apt                                      install
python-apt-common                               install
python-aptdaemon                                install
python-aptdaemon.gtk3widgets                    install
python-beautifulsoup                            install

On the target server the output of the above command could be used as-is to completely replicate the packages by following this sequence (note the first step is not necessary but it's a good idea to allow you to roll back a mistake!):

destination-server# dpkg --get-selections > backup-destination-server-get-selections
destination-server# dpkg --clear-selections
destination-server# cat dpkg-get-selections-ouput-from-source-server | pkg --set-selections
destination-server# aptitude install

You can also use a tool called dselect (dselect install) but aptitude does the job.

Alternately if you just want to bring missing libraries over you can filter those out of the initial --get-selections output and then apply them to the destination server without clearing the selections:

destination-server# grep '^python' dpkg-get-selections-ouput-from-source-server | pkg --set-selections
destination-server# aptitude install

BradsWiki: Synchronise debian packages between servers (last edited 2014-09-23 06:02:32 by BradleyDean)