There's a lot of info on the web, but I never can find a complete canonical way of doing this when I need it, so here's mine:
On the source machine, dpkg --get-selections > my-selections
(here, everybody agrees though)
On the target machine:
# apt update
# apt-cache dumpavail | dpkg --merge-avail
# dpkg --clear-selections # that's dangerous if you don't set reasonable selections afterwards!
# dpkg --set-selections < my-selections
# apt-get -u dselect-upgrade
And voila.