So to work with software, first thing you need to know about is the RPM packages.
Software on RHEL is installed using packages in RPM format.
And an RPM package contains the compressed archive as well as package metadata.
And in the metadata, package dependencies are identified.
To automatically handle dependency management, RHEL uses DNF and repositories for package
installation.
Packages should not be installed with the RPM command.
That's an old command.
Don't use it for installation.
Just use DNF for installation.
The packages are registered in the RPM database.
And the RPM command can be used to list packages and analyze package content based on the information
in that database.
So some commands can be used to query the database.
And that can be convenient to analyze what is going on.
Like RPM minus QA, which shows all packages that are currently installed.
Or RPM minus QF, followed by a filename, which shows from which package this specific filename
was installed.
RPM minus QL lists files installed from a package.
And RPM minus Q minus minus scripts shows scripts that are executed while installing
the packets.
RPM minus Q changelog is showing the changelog.
And querying packages in package file is also possible.
Just add P to any of the commands above.
So just to summarize, if you want to query the database, you use RPM minus QA.
If you want to query a package file that you have locally installed in the current directory,
use RPM minus P QA to indicate that you want to query a file and not a database.
It's even possible to extract RPM packages without installing them.
To do so, you use RPM to CPIO, which is converting the RPM package to a CPIO archive format.
So following this command, you have the name of the package.
You pipe that to CPIO minus TV.
And that will show the contents of the package.
And if you still are convinced that you want to extract it, use RPM to CPIO, followed by
the package name, and pipe that to CPIO minus IDMV.
And that will extract the package contents to the current directory.
In some cases, that might be convenient if you want to work with a specific file in your package.
Now let's do a demo.
And in this demo, I'm going to show you how to use RPM to analyze packages.
So if you want to, I would advise to pause the video here.
Try it for yourself.
And after that, you can listen to my explanation.
You have seen what it is doing.
So let me show you.
So first, I want to use RPM minus QF.
RPM minus QF is what you can do to query a file.
And I'm querying the file etccrypttab.
And that is showing that etccrypttab is coming from the package systemd udev.
So if I want to know more about this package systemd udev, I would use RPM minus QL systemd-udev,
which is showing a list of all the files in this package.
And as udev is the plug-and-play manager, well, there's a lot of files, no less than 516.
Oh my goodness, that's a lot.
Now maybe you want to have some more specific information, like which configuration files
do we have in this package.
Then you use RPM minus QC on systemd-udev.
And you can see a list of all the different configuration files.
And that might help you in finding out what you need to do to configure a specific file
or a specific service on your Red Hat system.