Yummy, yummy, yummy
Serve Me Right
The RPM package manager Yum has its own advantages over other tools.
A decade ago, Debian users used to look down on users of Red Hat and other RPM-based distributions. Whereas Debian users had apt-get and dpkg to save them from dependency hell – situations in which software installation is impossible because of an uninstalled library – users of RPM-based distributions had to dig themselves out of dependency hell on their own.
Today, Debian and Ubuntu users have no reason to be so smug. The RPM distros have caught up with the Debian tools and produced several package managers that more or less equal apt-get's functionality.
Of these package managers, the most popular is Yellowdog Updater, Modified, better known as Yum. This rewriting of an earlier package manager for Yellow Dog Linux is now maintained by Seth Vidal, a Red Hat Employee, and used by many of the major RPM distributions, including Fedora, Red Hat, and CentOS.
Just as apt-get in Debian provides users access to the functionality of dpkg, so Yum acts as a wrapper for rpm, the basic command for RPM package management. The main difference is that, whereas dpkg resolves dependency problems on its own, rpm does not. That functionality resides entirely in Yum.
From the user's perspective, this difference is unimportant. Although you can use Yum indirectly from such desktop applications as PackageKit and Yumex, Yum is so well written that you can easily learn to run it directly from the command line.
Learning the Basics
Like apt-get, Yum has a consistent basic format: the basic command (yum), the sub-command (what you are doing), and the packages involved. The main difference is in the list of sub-commands involved. Yum is more organized than apt-get, and some of its sub-commands provide functionality that with apt-get reside in a related utility, such as apt-cache.
The sub-command that you will probably use most often is install. For instance, if you plan to install the Book typeface for the free Gentium font, the basic command in Fedora would be
yum install sil-gentium-basic-book-fonts
much as it would be with apt-get (although the exact package name might differ).
However, Yum is somewhat more verbose than apt-get in offering feedback (Figure 1). It begins by listing which plugins are installed for Yum, then it calculates which packages need to be updated and which dependencies the requested package needs. For instance, if you decided to install Gentium Book, Yum would note that it requires the package sil-gentium-basic-fonts-common, which is needed with any weight of Gentium that you install.
Finally, Yum notes whether all dependencies are available and presents everything that needs to be installed in a table. This table is followed by a second that lists the transactions (i.e., steps) needed to complete the installation and the total amount of hard disk space required. Only then does Yum offer you a choice of whether to continue or halt installation.
Once you press y (for "yes") to continue the installation process, Yum begins to download the necessary packages, showing the progress of each download and of the overall process. After the downloads are complete, Yum installs each package and summarizes what it has done (a useful step, in that the original information might easily have scrolled out of sight). If it is successful, a succinct Complete! displays just before Yum exits (Figure 2).
With apt-get, you would use dpkg to install a package you had downloaded to a Debian system; however, with Yum you would simply use the localinstall sub-command and not have to switch basic commands.
To install a newer version of a package, you can also use install, but a better choice is the upgrade sub-command because it can handle the removal of any obsolete packages – an ability that is especially useful when you are switching from one version of a distribution to another. For the same result, you can use yum update --obsoletes. If you are cautious, you might prefer to use the check-update sub-command to see what is available before actually installing anything. Or, you might prefer to specify particular packages to upgrade instead.
To upgrade local packages, the sub-command is localupdate. To uninstall, use the remove sub-command.
All of these basic sub-commands are available for use on multiple packages. The simplest way to handle multiple packages is to enter a space between them at the end of the command. Alternatively, you might want to use regular expressions, although generally you should use the search sub-command first to see which packages will be affected.
Some Yum repositories organize packages into groups. For example, in Fedora 11, the package groups include Games, KDE Desktop, and Publishing. These groups serve much the same function as meta-packages on Debian systems, allowing you to install multiple packages without having to remember them or edit them separately. Groups have a series of special sub-commands that include groupinstall, groupupdate, and groupremove, followed by the name of the group. For example, yum groupinstall publishing would add all the files in the publishing group to your system.
Besides to these basic sub-commands, Yum also includes several that provide information or help you to maintain your system.
The most basic sub-command, list, is completed by self-explanatory descriptions of the information you want. For instance, the command yum list installed displays a compete list of installed packages. Similarly, yum list available lists all the packages in all repositories, and yum list updates lists all available updates. Other, more specific, descriptions include extras, which lists packages on your system that are not listed in enabled repositories, and recent, which lists the latest updates in the repositories.
When you want more specific information about a package, the sub-command to use is info, followed by the package name. The info command provides basic information about the package: its architecture; its version number and release; whether it is installed or, if not, what repository it is in; its license; and its homepage (Figure 3). Also, you will receive a single-sentence summary and a slightly longer description. The sub-command groupinfo provides similar information for package groups.
A rarer, but occasionally useful, sub-command is provides. With the provides command, you can find which package includes a particular file or feature (Figure 4). For example, in Fedora 11, the command yum list provides firefox returns exactly which package version is available or installed as well as the versions found in the repositories.
Another means of tracing references to a specific package is the search sub-command. This function will locate all packages and dependencies related to the search term, followed by a brief description. Similar to apt-cache on Debian systems, search can be useful for finding packages when you lack an exact name or are reasonably sure that a function must be available somewhere.
All these information sub-commands frequently give dozens, even hundred of lines of output. For this reason, consider piping them through the less command so that you can scroll through at your leisure. For example, with yum list obsoletes | less, you can browse a list of the installed packages that are made obsolete by packages in the repositories.
Yum sub-commands also include a series of utilities to help you maintain and troubleshoot your system. For instance, yum makecache downloads the information for all packages in all enabled repositories, which you can use if the information is corrupted or if you have recently changed repositories. Similarly, for the rare time that dependency problems suddenly emerge, yum resolvedep can tell you which packages provide a missing dependency.
A particularly powerful maintenance tool is clean, which, like list, is completed by a description of the information source that you want to remove. However, with the exception of the command yum clean packages, which removes packages that were downloaded but not installed, using clean is an act of desperation.
Running clean followed by any other option – expire-cache, headers, meta-data, dbcache, or all – removes information that Yum requires to operate. The next time you start Yum after running clean with these completions, Yum will rebuild what was deleted, but it could take as long as 20 minutes to do so, depending on your machine. For this reason, you should only run the clean sub-command when you are having trouble with Yum and all other means of troubleshooting have failed. Unlike apt-get's clean and autoclean, Yum's clean is not for routine maintenance, but for major problems, and you will only inconvenience yourself if you run it casually.
Powerful man-in-the-middle attack is now targeting online shopping.
Another high-profile coder says the kernel team needs a kinder, gentler culture.
Bug database has a bug of its own that could allow an intruder to create an unauthorized account.
Report focuses federal resources on achieving universal Internet access.
Leading browser makers say “no” to porous encryption algorithm
Report from the X-Force group says attackers are using TOR to hide their crimes
Future Firefox extensions will be compatible with Chrome.
Better read this if you bought your computer before 2011
Users should upgrade to the new version as soon as possible
Xen project announces a privilege escalation problem for Qemu host systems