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-fastestmirror
and it will choose the closest mirror to you, instead of using a random mirror from the mirrorlist. Your fastest mirror is recalculated once every 10 days by default; if you would like to force it now,rm /var/cache/yum/timedhosts.txt
An alternative to using yum-fastestmirror is to manually edit your /etc/yum.repos.d/*.repo files to use a specific baseurl=foo instead of using a mirrorlist=foo
Also note that yum will check for and download updated package metadata every 30 minutes by default (see /etc/yum.conf), leading some to the false conclusion that it’s “slower” than apt-get because apt-get only works from the fast 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, doyum provides \*/foobar
Note: 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, doyum 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 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, dorpm -qlp foobar.rpm
. If you don’t already have the rpm installed, or available, dorepoquery --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, doyum 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 or be fixed by developers.
- Look into using the yum-priorities plugin to prevent 3rd-party packages from overriding base packages in the first place.
- Run
-
Q: How can I download a rpm or a source rpm from a repository without installing it?
A:
yumdownloader foobar
oryumdownloader --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=\* --en=fedora\*,updates\*,livna\* 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.
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 #centoshelp on irc.freenode.net
Added Reading
- man yum
- man rpm
- YumFaq @ Yum Project Wiki
- Yum compared to Apt