Yum & RPM FAQ
by zcat — last modified Oct 10, 2009 02:26 PM — filed under: Server Solutions, Post-Install Solutions
Solutions to some of the most commonly asked yum and rpm questions. How do I...
Q: How can I speed up yum? It seems slow.
A: yum install yum-plugin-fastestmirror and it will then choose the closest mirror to you (measured by ping time; not bandwidth, but they are often closely correlated), instead of using a random mirror from the mirrorlist by default. Your fastest mirror is recalculated once every 10 days by default, but if you would like to force it to update now, delete the cachefile: rm /var/cache/yum/timedhosts.txt
UPDATE: As of yum-plugin-fastestmirror version 1.1.23-1, it is possible to configure it to choose your preferred mirror, instead of the "fastest" one. To do so, add a line such as "prefer=my.fastest.mirror.com" to /etc/yum/pluginconf.d/fastestmirror.conf
An alternative to using yum-fastestmirror is to manually edit your /etc/yum.repos.d/*.repo files individually to use a specific baseurl=foo instead of using a random mirrorlist=foo
Also note that yum will check for and download updated package metadata every 1.5 hours by default (see metadata_expire in /etc/yum.conf (man yum.conf)), leading some to the false conclusion that it's "slower" than apt-get because apt-get only works from the fast and stale cache until you manually tell it to update with "apt-get update". To emulate this behavior with yum, use the "-C" option to use only the cache (e.g.: "yum -C install foobar" will install the most up-to-date version of foobar that your cache knows about, *without* first checking for updates from all your other enabled repos. To manually update your cache, do yum makecache.
Q: How can I find out what package provides the file "/usr/bin/foobar"?
A: If the file is already installed on your system, do rpm -qf /usr/bin/foobar. If the file is not already installed on your system, do yum provides \*bin/foobar
Note: unquoted wildcards '*' need to be escaped with the backslash "\" so that yum sees them, instead of being expanded by your shell (bash).
Q: Does fedora have "foobar"?
A: yum list foobar to find out; to list all packages that have "foobar" in their name, do yum list \*foobar\*.
NOTE: package names are case sensitive, and while most are lower-case, you might also want to check different case combinations. e.g.: \*FooBar\*. (yum search, on the other hand, is not case sensitive.)
"yum list foo\*" will list packages that are both installed and packages that are available to be installed. To show only packages that are available to be installed, use "yum list available foo\*". To show only packages that are already installed, use "yum list installed foo\*", or, alternatively "rpm -qa foo\*"
Q: How can I search for all packages that have anything at all to do with the term "foobar"?
A: yum search foobar. For example: "yum search ldap" will return a list of packages with "ldap" in their name or in their descriptions (e.g.: fedora-ds (Fedora Directory Server)).
NOTE: Older versions of yum search required the use of wildcards and returned much more verbose output.
Q: How can I list all the files in a package?
A: If the package is already installed on your system, do rpm -ql foobar, or if it's a downloaded rpm file, do rpm -qlp foobar.rpm. If you don't already have the rpm installed, or available, do repoquery --list foobar. reqoquery is provided by yum-utils.
Q: How can I install a RPM package I downloaded named foobar.rpm?
A: Use yum localinstall foobar.rpm and it will install it as well as download & install any needed dependencies. If you get an error about the package not being signed, you can bypass it by adding the --nogpg option. Only use this if you trust that the package is not tainted (e.g. you downloaded it from koji, or some other source you can trust.)
NOTE: this is more powerful than using the lower-level rpm -Uvh foobar.rpm method you may already be familiar with.
Q: How can I force yum to install something like rpm --nodeps --force can?
A: You can't, and you shouldn't. yum won't allow you to shoot yourself in the foot like rpm will.
Q: How can I install KDE or all of the Development utils I need?
A: Fedora has many groupings of related packages; to see them all, do yum grouplist. To see more info about a particular group, do yum groupinfo "Foo Bar", and to install it: yum groupinstall "Foo Bar"
Q: HELP! "Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again"?
A: This error means that yum can't contact its update mirrors, either because your network is down, or because the specific mirror you're using is temporarily unavailable.
The most common fix for this is to make sure your network is up and to run yum clean all and then try again. If for some reason that doesn't work, wait a few hours and try again.
Q: HELP! "Transaction Check Error: file /usr/lib/foobar.so from install of foobar-0.1 conflicts with file from package snafu-1.0" or "Error: Missing Dependency: foo-lib(plugin-abi) = 1.20 is needed by package snafu-lib-1.2.3-1.abc.i386 (randomrepo)"?
A: Package conflicts are most often caused when attempting to use unofficial 3rd-party repositories that don't integrate cleanly with fedora.
There are a few things to try when stuck in this situation: Run yum clean all and try again. If using a nasty incompatible 3rd-party repo, remove it, and attempt to reverse any damage it did. Use yum --exclude=snafu,badpackage2,badpackage3 to temporarily exclude the conflicting packages from your install or update Add "exclude=snafu,badpackage2,badpackage3" to /etc/yum.repos.d/foo.repo to exclude it more permanently. Wait a few hours or days for the problem to clear up by itself Look into using the yum-priorities plugin to prevent 3rd-party packages from overriding base packages in the first place.
Q: How can I download a rpm or a source rpm from a repository without installing it?
A: yumdownloader foobar or yumdownloader --source foobar. yumdownloader is provided by yum-utils.
Q: How can I determine what all the naughty 3rd-party packages are on my system?
A: yum --disablerepo=\* --enablerepo=fedora\*,updates\*,livna\*,rpmfusion\* list extras. This may take a long time, so be patient. The resulting list of packages should be relatively short. You may sometimes see valid packages in this naughty list. e.g.: old kernels which are no longer available in any repo.
Q: I lost power/crashed/suspended in the middle of my last yum update, and now I can't use yum at all. What gives?
A: First try running yum-complete-transaction, and if that doesn't work, try resetting your corrupt rpmdb by doing rm -f /var/lib/rpm/__db*
More Information When in doubt, "man yum" and "yum --help". Disclaimer
We test this stuff on our own machines - really we do - but you may run into problems; if you do, come to #fedora on irc.freenode.net Added Reading
man yum man rpm YumFaq @ Yum Project Wiki Yum compared to Apt