On any Debian based machine, this is one common way to duplicate a package set. On the old machine:
dpkg --get-selections "*" > my_favorite_packages
Copy the file my_favorite_packages
to the new machine (a thumb drive is a good option, but scp
also works fine). Then run this sequence (with root privileges):
apt-get update
dpkg --set-selections < my_favorite_packages
apt-get -u dselect-upgrade
This doesn't get you only the packages you installed. It also gets their dependencies, etc. Also, if the repositories between the two machines are different, all bets are off.
As far as logs, apt-get
keeps a log at /var/log/apt/history.log
(thanks to Tshepang for updating this in a comment); dpkg
does (at /var/log/dpkg.log
), but it's famously hard to parse and can only be read with root privileges; aptitude
has one at /var/log/aptitude
and you can page through it with regular user privileges.
As far as I can tell, you are right that none of these logs track specifically what you installed as opposed to auto-installed dependencies. You can get that information, however, from an aptitude
search. Search for all installed packages that were also installed automatically:
aptitude search '~i ~M'
If you want only the ones you installed (not the auto-dependencies), negate the ~M
:
aptitude search '~i !~M'
If you want that formatted so that you have only the names of packages and the word "install", aptitude
can do that too. This gives you a list ready to feed to dpkg --get-selections
:
aptitude search '~i !~M' -F "%p install"
(I've got nothing on RedHat or RedHat-based systems. Sorry. There really is no one answer for Linux per se since package management is a big part of what makes different distros different.)
Best Answer
For Fedora you can use package-cleanup, for example with the
--leaves
option.