DNF provides both a history using using dnf history list
And a history for a specific package using dnf history list packagename
Since I have to look this up each time — here are the commands to upgrade Fedora to the next (n+1 or n+2 version)
Presupposes the system upgrade plugin is installed. If not, run:
dnf install dnf-plugin-system-upgrade
To upgrade, run:
NEWVERSION=39
dnf upgrade --refresh
dnf system-upgrade download --releasever=$NEWVERSION
dnf system-upgrade reboot
Since this is the fifth time this month that I’ve spun up some CentOS image and been stymied by the inability to install new packages … I’m going to write down the sed commands that magic the default yum repository configuration to something that’s still functional.
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Beyond basic stuff like “dnf install somepackage” or downloading an rpm and using “dnf install my.package.rpm”, this is a running list of useful dnf commands.
List installed packages (similar to rpm -qa):
dnf list installed
List packages with updates available:
dnf check-update
Update everything but the kernel:
dnf update -x kernel*
Find package that provides something:
[lisa@rhel1 ~/]# dnf whatprovides cdrskin Last metadata expiration check: 2:35:57 ago on Fri 12 Aug 2022 11:37:43 AM EDT. cdrskin-1.5.2-2.fc32.x86_64 : Limited cdrecord compatibility wrapper to ease migration to libburn Repo : fedora Matched from: Provide : cdrskin = 1.5.2-2.fc32 cdrskin-1.5.4-2.fc32.x86_64 : Limited cdrecord compatibility wrapper to ease migration to libburn Repo : updates Matched from: Provide : cdrskin = 1.5.4-2.fc32
Package info, including version
[lisa@rhel1 ~/]# dnf info sendmail Last metadata expiration check: 2:37:19 ago on Fri 12 Aug 2022 11:37:43 AM EDT. Available Packages Name : sendmail Version : 8.15.2 Release : 43.fc32 Architecture : x86_64 Size : 730 k Source : sendmail-8.15.2-43.fc32.src.rpm Repository : fedora Summary : A widely used Mail Transport Agent (MTA) URL : http://www.sendmail.org/ License : Sendmail Description : The Sendmail program is a very widely used Mail Transport Agent (MTA). : MTAs send mail from one machine to another. Sendmail is not a client : program, which you use to read your email. Sendmail is a : behind-the-scenes program which actually moves your email over : networks or the Internet to where you want it to go. : : If you ever need to reconfigure Sendmail, you will also need to have : the sendmail-cf package installed. If you need documentation on : Sendmail, you can install the sendmail-doc package.
Show history:
[lisa@rhel1 ~/]# dnf history ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 102 | remove liberation-fonts | 2021-11-28 18:44 | Removed | 3 101 | remove chromedriver | 2021-11-28 18:44 | Removed | 2 100 | remove google-chrome-stable | 2021-11-28 18:44 | Removed | 1 < 99 | install liberation-fonts | 2021-11-28 18:42 | Install | 1 > 98 | install chromedriver | 2021-11-28 18:38 | Install | 2 97 | remove mediainfo | 2021-11-16 13:31 | Removed | 4 96 | install mediainfo | 2021-11-16 13:29 | Install | 4
Which brings up an interesting command — you can undo a history step instead of trying to uninstall the list of things you just installed.
dnf history undo 98 -y
“Dependency hell” used to be a big problem — you’d download one package, attempt to install it, and find out you needed three other packages. Download one of them, attempt to install it, and learn about five other packages. Fifty seven packages later, you forgot what you were trying to install in the first place and went home. Or, I suppose, you managed to install that first package and actually use it. The advent of repo-based deployments — where dependencies can be resolved and automatically downloaded — has mostly eliminated dependency hell. But, occasionally, you’ll have a manual install that says “oh, I cannot complete. I need libgdkglext-x11-1.0.so.0 or libminizip.so.1 … and, if there’s a package that’s named libgdkglext-x11 or libminizip … you’re good. There’s not. Fortunately, you can use “dnf provides” to search for a package that provides a specific file — thus learning that you need the gtkglext-libs and minizip-compat packages to resolve your dependencies.