RPM is the package manager format used on Fedora Core (it’s also widely used on others). It stands for Red Hat package Manager (well, who cares anyway). You probably already know you can install or uninstall RPMs, but you can do way more than that. RPM is the filename extension of individual packages you can install, but it’s also the name of the whole underlying system that keeps track of what’s installed on your computer, where and how. The
rpm command has lots of parameters and options. Here’s a couple of ones I use 99% of the time.
To install an .rpm package:
-U as in update which permits the package manager to update to a newer version a program you already installed before. Don’t worry if the rpm file you install was never installed before, because if this is the case, then the package manager will behave as if you specified -i instead of -U, which means of course: install.
So in short: always use -U, never use -i.
One exception is to be noted: kernels can be installed multiple times (in different versions), so always use -i and not -U when manually installing kernels.
-h and -v are only to display stuff while rpm is working (by default it’s totally silent).
To list currently installed packages:
-q as in query, which means that rpm has to just query its database, not installing or uninstalling anything. -a means all packages.
For a faster version that doesn’t check signatures or compute digests, you can use:
To list all the files installed by a specific package:
-l as in list files.
Note that you don’t have to type the version number of the package.
For example if with the previous installed packages listing command you had “bash-3.1-6.2”, you can only use “bash” here.
To check the consistency of an installed package:
-V as in verify. If nothing is displayed, then everything is okay. Else, you will have one line per file-problem with a letter-code telling you what’s the problem (missing file, changed size, changed permissions, changed checksum, etc.). It’s detailed in the
To uninstall a package:
-e as in erase. Beware: it won’t ask you for confirmation.
To ask RPM to which package a given file belongs to:
I find this one particularely great !
To list the contents of an rpm file:
-p as in package. You can also use -qlpv if you want more details.
Note the difference between -ql and -qlp: the first is about an already installed package (you don’t even need to still have the rpm file you used to install it), the second is about an actual rpm file (installed or not).
Now, last but not least… how to extract the contents of an rpm file ?
I mean, how extracting the contents of an rpm file without installing it at all ? This can be useful if you just need one file stored in an rpm but don’t want to install the whole stuff. Well, this is pretty easy (once you know it !). Place yourself into an empty directory, and type:
That’s all ! The
<color red>cpio program is found in the RPM of the same name (just
yum install it if you don’t have it).