Skip to content

Instantly share code, notes, and snippets.

@phpclub
Created April 3, 2025 18:21
Show Gist options
  • Save phpclub/e08cf5861f4fa175ccb9baedb038a3a0 to your computer and use it in GitHub Desktop.
Save phpclub/e08cf5861f4fa175ccb9baedb038a3a0 to your computer and use it in GitHub Desktop.
How to replicate installed package selection from one Almalinux instance to another?
the Dnf repoquery subcommand supports has a new option for listing all user-installed packages:
$ dnf repoquery --qf '%{name}' --userinstalled \
| grep -v -- '-debuginfo$' \
| grep -v '^\(kernel-modules\|kernel\|kernel-core\|kernel-devel\)$' > pkgs_a.lst
In contrast to other methods, it also lists all debuginfo packages. The additional grep in the above example filters them out.
To install the list on host B:
$ < pkgs_a.lst xargs dnf -y install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment