Выбрать главу

Installing for dependencies:

SDL_mixer i386 1.2.6-1.fc4 extras 84 k

Transaction Summary

==========================================================================

Install 2 Package(s)

Update 0 Package(s)

Remove 0 Package(s)

Total download size: 2.9 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): SDL_mixer-1.2.6-1. 100% |=========================| 84 kB 00:03

(2/2): abe-1.0-5.i386.rpm 100% |=========================| 2.9 MB 02:16

Running Transaction Test

Notice that yum automatically determined that SDL_mixer was required, confirmed the installation of both packages with the user before installing, downloaded the software in RPM format, and then installed it.

From this output, you can also see that yum started off by updating its list of available packages in each repository and later downloaded the header files for each selected package. A header file contains a package's metadata but not the installation files and scripts (and is therefore much smaller); this lets yum determine dependencies and test for file conflicts without downloading the entire package.

To install a package file that is on the local computer (e.g., received in an email from a developer or on a CD) and still take advantage of the repositories to solve dependency problems, use yum 's localinstall command:

# yum localinstall /tmp/frodo-9.6.23-4-i386.rpm

Removing software is just as simple as installing it; use yum 's remove command:

# yum remove httpd

Setting up Remove Process

Resolving Dependencies

...(Lines snipped)...

Dependencies Resolved

==========================================================================

Package Arch Version Repository Size

==========================================================================

Removing:

httpd i386 2.0.54-10.2 installed 2.5 M

Removing for dependencies:

htdig-web i386 3:3.2.0b6-5 installed 1.1 M

httpd-devel i386 2.0.54-10 installed 466 k

httpd-devel i386 2.0.54-10.2 installed 466 k

httpd-manual i386 2.0.54-10.2 installed 7.5 M

...(Lines snipped)...

squirrelmail noarch 1.4.6-0.cvs20050812.1.fc4 installed 8.1 M

system-config-httpd noarch 5:1.3.2-2 installed 1.6 M

webalizer i386 2.01_10-28 installed 244 k

wordtrans-web i386 1.1pre13-10 installed 31 k

Transaction Summary

==========================================================================

Install 0 Package(s)

Update 0 Package(s)

Remove 39 Package(s)

Total download size: 0

Is this ok [y/N]: n

Exiting on user Command

Complete!

Here, the removal of httpd would cause dependency failures for 38 other packages, so yum offered to remove all 39 packages together. In this case, the user elected not to proceed, so yum exited.

yum can also update software:

# yum update

Setting up Update Process

Setting up repositories

...(Lines snipped)...

Transaction Summary

==========================================================================

Install 5 Package(s)

Update 19 Package(s)

Remove 0 Package(s)

Total download size: 27 M

Is this ok [y/N]: y

Downloading Packages:

(1/24): bind-utils-9.3.1- 100% |=========================| 146 kB 00:00

(2/24): esound-0.2.36-0.f 100% |=========================| 127 kB 00:00

...(Lines snipped)...

Running Transaction Test

Repackage : bind-utils ####################### [ 0/43]

Repackage : esound ####################### [ 0/43]

...(Lines snipped)...

Installing: GFS-kernel ####################### [22/43]

Updating : bind-libbind-devel ####################### [23/43]

Installed: GFS-kernel.i686 0:2.6.11.8-20050601.152643.FC4.17 cman-kernel.i686

...(Lines snipped)...

pam.i386 0:0.79-9.6 pam-devel.i386 0:0.79-9.6 sudo.i386 0:1.6.8p8-2.3

Complete!

For each of the currently installed packages, yum checks to see if a newer version exists in any of the repositories and queues the update of those packages plus the installation of any packages required for dependency resolution. After confirming the package set with the user, the packages are downloaded and the update/installation is performed through the RPM system.

To update one specific package (and dependencies), list the package name as an argument:

# yum update kernel

yum also offers a number of information and miscellaneous options; the most useful are shown in Table 5-5 . However, most of these operations are more easily performed using the graphical user interface (GUI).

Table 5-5. Information and miscellaneous commands for yum

Option Description
list Lists available packages.
check-update Verifies whether any updates are available. An exit code of 100 indicates that updates are ready for installation.
whatprovides capability Displays the name of any packages that provide the listed capability, which may be an RPM-style capability name or a filename.
provides capability
search keyword Searches for a package with keyword in the description, summary, packager name, or package name metadata. The search is case-insensitive.
info package Displays metadata about package (similar to rpm -qi).
deplist package Displays the dependencies of package, including the names of the packages that will resolve those dependencies.
localinstall rpm_file Installs or removes the package contained in the local rpm_file and, if necessary, resolves any dependencies using the repositories.
localupdate rpm_file
-C Runs the specified command from cache (doesn't contact each repository to check for updates).