The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации

Next Previous Contents

5. Using RPM

See also RPM-HOWTO document.

5.1 Basic RPM Commands

In its simplest form, RPM can be used to install, erase or upgrade packages:


bash# rpm -i foobar-1.0-1.i386.rpm   ...(to install packages)
bash# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm ...(to install package via ftp)
bash# rpm -e foobar  ...(to uninstall package)
bash# rpm -U foobar-1.0-1.i386.rpm  ...(to upgrade package)
bash# rpm --help  ...(to see help on rpm options)
bash# man rpm  ...(to read online manual page)

5.2 RPM Build Commands

To build rpm packages


bash# rpm -i foobar*.src.rpm
bash# cd /usr/src/redhat/SPECS
bash# rpm -ba foobar-1.0-1.spec

To build in incremental steps, do:
bash# rpm -bp foobar-1.0-1.spec    ...( to do prep stage)
bash# rpm --short-circuit -bc foobar-1.0-1.spec    ...( to do build stage)
bash# rpm --short-circuit -bi foobar-1.0-1.spec    ...( to do install stage)
bash# rpm -ba foobar-1.0-1.spec  ... (to do binary and source package)

5.3 RPM Query Commands

You can query the rpm database with these powerful commands:


bash$ rpm -qpl foobar-1.0-1.i386.rpm  ....(list of files in a rpm package)
bash$ rpm -ql foobar-1.0-1   ....(list of files from already installed package)

bash$ rpm -qpR foobar-1.0-1.i386.rpm  ....(list packages on which this package depends)
bash$ rpm -qR foobar-1.0-1  ....(list packages on which this installed package depends)

bash$ # rpm -q foo  ...(print package name, version, and release number of package foo)
foo-2.0-1

bash$ rpm -qa | less   ....(list all the installed package)
bash$ rpm -qa | grep -i kde   ....(list all the installed package matching kde)
bash$ rpm -qif /bin/ls ....(list the package which installed the file /bin/ls)

To show the values RPM will use for all of the options that may be set in rpmrc files
(/usr/lib/rpm/rpmrc, /etc/rpmrc, ~/.rpmrc ), type:
bash$ rpm --showrc | less

5.4 RPM Verify Commands

Verifying a package compares information about files installed from a package with the same information from the original package. Among other things, verifying compares the size, MD5 sum, permissions, type, owner and group of each file.

The command rpm -V verifies a package. You can use any of the Package Selection Options listed for querying to specify the packages you wish to verify. A simple use is rpm -V foo which verifies that all the files in the foo package are as they were when they were originally installed. For example:


bash$ rpm -Vf /bin/vi ...(To verify a package containing particular file)
bash$ rpm -Va ...(To verify ALL installed packages) 
bash$ rpm -Vp foo-1.0-1.i386.rpm ...(To verify an installed package against an RPM package file)

This can be useful if you suspect that your RPM databases are corrupt.

If everything verified properly there will be no output. If there are any discrepancies they will be displayed. The format of the output is a string of 8 characters, a possible "c" denoting a configuration file, and then the file name. Each of the 8 characters denotes the result of a comparison of one attribute of the file to the value of that attribute recorded in the RPM database. A single "." (period) means the test passed. The following characters denote failure of certain tests:


     5 -- MD5 checksum 
     S -- File size 
     L -- Symbolic link 
     T -- File modification time 
     D -- Device 
     U -- User 
     G -- Group 
     M -- Mode (includes permissions and file type) 
     ? -- Unreadable file 

If you see any output, use your best judgment to determine if you should remove or reinstall the package, or otherwise fix the problem.
Next Previous Contents


Спонсоры:
Слёрм
Inferno Solutions
Hosting by Ihor
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2019 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру