Table of Contents
Fedora preinstall
Backup installed software list
dnf list installed > fedoraxx_list_installed
Manually installed package:
Have you already discovered the command sudo dnf history? You can use it to access a database with all previous transaction. Each transaction has an ID number (first column).
The history command knows the following sub-commands: list, info, redo, undo, rollback, userinstalled
Now, you can get a list of all user-installed packages.:
sudo dnf history userinstalled.
You can also list all changes of a transaction:
sudo dnf history list <i> #, ie sudo dnf history list 1,
or get more info about the packages of a certain transaction:
sudo dnf history info <i> #, ie sudo dnf history info 4
To undo a complete transaction, you do: sudo dnf history undo <i>.
For more details about dnf type man dnf or dnf –help in your terminal. There is plenty more you can do with dnf…
Install packages from list
I created a list of all packages on my F21 system with:
rpm -qa --qf "%{NAME}.%{ARCH}\n" | sort > Packages.LST
After a clean install of F22, I tried to reinstall all those packages with:
dnf -y install $(cat Packages.LST)
This used to work fine with Yum, but DNF fails and exits with an error when it tries to install a package that does not exist in the F22 repos. This appears to be a “feature” of DNF.
Dnf and yum will quit if a package member is not present. The rules are ALL or nothing. I posted a script that I used to download groups. Take a look at it and modify it to your needs. I have it running for packages. If one package fails to exist, it still keeps on going.
Working
I turn the list into a bash script. add
#! /bin/bash sudo dnf install #to the front of each line.
You can use an editor like gedit to change all line ends, to line ed sudo dnf install. Copy a lineend into the input column. Extra junk on the copy just delete down to the lineend
chmod 774 your-script-name ./your-script-name
multiple installs are ok. They will be ignored.
Better
In Console:
rpm -qa > /backup/installed-software.log for i in $(cat /backup/installed-software.log) ; do packages+="$i " ; done yum install $packages