1. Get installed packages from both computers:
dpkg --get-selections > /safe/location/installed-old
dpkg --get-selection > /safe/location/installed-new
2. Save metadata from old computer:
apt-mark showauto > /safe/location/pkgs_auto.lst
apt-mark showmanual > /safe/location/pkgs_manual.lst3. Get list of packages to install:
grep -vFf installed-new installed-old > missingYou can go through that list manually to remove any that you don't want installed anymore.
4. On the new box, install packages:
cat missing | cut -f 1 | tr '\n' ' ' | sudo xargs apt-get -y --force-yes install
5. Restore metadata:
sudo apt-mark auto $(cat /safe/location/pkgs_auto.lst)
sudo apt-mark manual $(cat /safe/location/pkgs_manual.lst)This way system can still keep track of which packages were manually and which were automatically installed. This means that system can automatically remove packages no longer needed.
You have to add the missing apt repositories before step 4.