Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

154 Part II Installation

switch. The -U is really a combination of the -i and -e switches, and because of this, you can use it to install packages even when you have no upgrade to perform. The upgrade does not erase any files that are normally removed during an upgrade; therefore, it still installs the package by using the installation feature of upgrading. This is why many people who have used RPM for years may not use the -i switch to install packages; instead, they use the -U switch to perform installations and upgrades.

Query the RPM software

The query command in RPM allows you to query what has been installed, upgraded, and erased. This is a powerful tool, which you can use to query files for an individual package or to learn all the packages that are installed on the system. Table 5-6 shows the switches that are used with RPM and the query command.

Table 5-6

Red Hat Package Manager Query Commands

Switches used with

Switch performs this task

the rpm command

 

 

 

-q or --query

Query the installed package(s)

 

 

-a

Query all installed packages

 

 

-c

Display a list of configuration files

 

 

-d

Display a list of documentation files

 

 

--dbpath <path>

Use <path> to find RPM database

 

 

--dump

Display all verifiable information about each file

 

 

-f <file>

Query package owning <file>

 

 

-g <group>

Query packages belonging to <group>

 

 

-i

Display summary package information

 

 

-l

Display a list of the files in a package

 

 

<null>

Display full package label

 

 

-p <file> (or “-”)

Query a package <file> (URLs are okay here)

 

 

--provides

Display the capabilities the package provides

 

 

--qf or --queryformat

Display the queried data in a custom format

 

 

-R or --requires

Display the capabilities requirement of the package

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

-s

Displays the state of each file in the package

 

 

--scripts

Show the scripts associated with a package

Chapter 5 Advanced Installation 155

Switches used with

Switch performs this task

the rpm command

 

 

 

--root <path>

Set alternate root to <path>

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

--whatprovides <x>

Query packages providing capability <x>

 

 

--whatrequires <x>

Query packages requiring capability <x>

 

 

The ability to query the installed files is a very useful tool because you can learn which version of the C libraries is installed on a system. The following is an example:

[root@localhost /root]# rpm -q tar tar-1.13.19-4

[root@localhost /root]#

You can also use the query command to see all the RPM packages on the system; the following is an example:

[root@localhost /root]# rpm -qa |more indexhtml-7.1-2

specspo-7.1-1 pciutils-devel-2.1.8-19 cdda2wav-1.9-6 db3-3.1.17-7 gdbm-1.8.0-5 libjpeg-6b-15 mailx-8.1.1-20 esound-0.2.22-1 mpg123-0.59r-10 at-3.1.8-16 less-358-16 netpbm-9.9-5 playmidi-2.4-12 aspell-0.32.6-2 rmt-0.4b21-3 setserial-2.17-2 ntsysv-1.2.22-1 tar-1.13.19-4 mount-2.10r-5 crontabs-1.9-2 wget-1.6-2 cyrus-sasl-1.5.24-17 --More--

156 Part II Installation

In the preceding example, notice the use of the pipe (|) and more commands; if these options are not used, the list of RPM packages scrolls by very quickly. Finally, the query command is so useful because it has this format: The query is first, then the files to be queried, and finally the information to be queried for.

Verify the RPM software

2.19 Validate that an installed application is performing correctly in both a test and a production environment

You can also use RPM to verify that the software on the system is in working order. Use this verify command to make sure that the packages are still configured properly, to verify that no changes have been made to the system, or to verify that an accidental remove of files did not damage the system. Table 5-7 lists the switches that are used with the verify command.

Table 5-7

Red Hat Package Manager Verify Commands

Switches used with

Switch performs this task

the rpm command

 

 

 

-V or --verify

Verify the installed package(s)

 

 

-a

Verify all installed packages against the RPM database

 

 

--dbpath <path>

Use <path> to find RPM database

 

 

-f <file>

Verify package owning <file>

 

 

-g <group>

Verify the packages belonging to <group>

 

 

--nodeps

Do not check dependencies during verification

 

 

--nofiles

Do not verify file attributes

 

 

--noscripts

Do not execute verification scripts

 

 

-p <file> (or “-”)

Verify against a specific package <file>

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

--root <path>

Set alternate root to <path>

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

The verify command is very important in the installation of Linux because it enables the installer to verify that all packages are installed correctly. You can use the following command to verify all RPM packages installed on the system during installation or when adding packages.

Chapter 5 Advanced Installation 157

[root@localhost /root]# rpm -Va |more

.M......

 

/var/spool/at/.SEQ

S.5....

T c /usr/share/a2ps/afm/fonts.map

S.5....

T

/boot/kernel.h-2.4.2

.......

T

/lib/modules/2.4.2-2/modules.dep

.......

T /lib/modules/2.4.2-2/modules.generic_string

.......

T

/lib/modules/2.4.2-2/modules.isapnpmap

.......

T

/lib/modules/2.4.2-2/modules.parportmap

.......

T

/lib/modules/2.4.2-2/modules.pcimap

.......

T

/lib/modules/2.4.2-2/modules.usbmap

missing

 

/etc/identd.key

S.5....

T c /etc/X11/fs/config

missing

 

/usr/share/ssl/certs/stunnel.pem

Do not be surprised that some files won’t be verified, because RPM is very strict about passing the verification.

Verify the package files

The files contained in a package may be just as important as the verification of the package. To verify the individual files, answer the following questions:

Is the organization listed?

Have unauthorized changes been made to it?

Can it be trusted not to compromise the system?

You can resolve these questions with the file verification command. Table 5-8 shows the switches for this command.

 

Table 5-8

 

Red Hat File Verify Commands

 

 

Switches used with

Switch performs this task

the rpm command

 

 

 

-K or --checksig

Verify one or more package files

 

 

--nopgp

Do not verify any PGP signatures

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

Соседние файлы в предмете Операционные системы