Rpm Overview
Rpm has five basic operations (excluding creating software packages): installation, uninstallation, upgrade, query, and verification. Let's explain it one by one.
1. Install the RPM package
Rpm packages typically have file names similar to foo-1.0-1.i386.rpm. This includes the software package name (FOO), version number (1.0), Release number (1), and hardware platform (i386 ). To install a software package, simply type the following command:
$ Rpm-IVH foo-1.0-1.i386.rpm
Foo ####################################
After rpm is installed, the package name (not necessarily the same as the file name) is printed, and a series of # numbers are printed to indicate the installation progress. Although the installation of the software package is designed as easy as possible, the following errors may still occur:
1. The software package has been installed.
If your software package has been installed, the following information appears:
$ Rpm-IVH foo-1.0-1.i386.rpm
Foo package foo-1.0-1 is already installed
Error: foo-1.0-1.i386.rpm cannot be installed
If you still want to install the software package, you can use the -- replacepkgs option on the command line. RPM will ignore this error message and forcibly install it.
2. file conflict
If a file in the software package you want to install has been installed when other software packages are installed, the following error message is displayed:
# Rpm-IVH foo-1.0-1.i386.rpm
Foo/usr/bin/Foo conflicts with file from Bar-1.0-1
Error: foo-1.0-1.i386.rpm cannot be installed
To make RPM ignore this error message, use the -- replacefiles command line option.
3. Unresolved Dependencies
The RPM package may depend on other software packages, that is, it must be installed after a specific software package is installed. If this unresolved dependency exists when you install a software package. The following information is generated:
$ Rpm-IVH bar-1.0-1.i386.rpm
Failed dependencies: foo is needed by bar-1.0-1
You must install the dependent software package to solve this problem. If you want to force the installation (this is a bad idea, because the installed software package may not run normally), use the -- nodeps command line option.
Ii. Uninstall the RPM package
Uninstalling a software package is as simple as installing a software package:
$ Rpm-e foo
Note that the package name 'foo is used here, instead of the package file name 'foo-1.0-1. i386.rpm. If other software packages depend on the software packages you want to uninstall, an error message is generated when you uninstall them. For example:
$ Rpm-e foo
Removing these packages wowould break dependencies: foo is needed by bar-1.0-1
If you want RPM to ignore this error and continue to uninstall (this is not a good idea, because it depends on the software package'sProgram). Use the -- nodeps command line option.
3. Upgrade the RPM package
The upgrade package is similar to the installation package :.
$ Rpm-uvh foo-2.0-1.i386.rpm
Foo ####################################
Rpm will automatically uninstall the installed boss's foo package, and you will not see the relevant information. In fact, you may always use-u to install the software package, because it can run normally even if it has not been installed before. Because RPM performs Intelligent Software Package upgrades,
Automatically process the configuration file and you will see the following information:
Saving/etc/Foo. conf as/etc/Foo. conf. rpmsave
This indicates that your modifications to the configuration file may not be compatible with the configuration file. Therefore, the RPM will first back up the old file and then install the new file. You should resolve the differences between the two configuration files as soon as possible so that the system can continue to run normally.
Because the upgrade actually involves the process of uninstalling and installing the software package, you may encounter errors caused by these two operations. Another problem you may encounter is: When you use an earlier version of the software package to upgrade the new version of the software, RPM will produce the following error message:
$ Rpm-uvh foo-1.0-1.i386.rpm
Foo package: foo-2.0-1 (which is newer) is already installed
Error: foo-1.0-1.i386.rpm cannot be installed
If you do need to downgrade the software package, add the -- oldpackage Command Option.
4. query installed software packages
Run the command rpm-Q to query the database of the installed software package. The command rpm-Q Foo will print the package name of the foo package,
Version number, and line number:
$ Rpm-Q foo
Foo-2.0-1
In addition to specifying the software package name, you can use the following options to specify the information of the software package to be queried. These options are called "Software Package-specific options".
·-A query all installed software packages
·-F will query software packages containing files.
·-P: query the software package with the file name
You can also specify the information displayed when querying the software package. They are called information selection options:
·-I displays the software package information, such as description, Release number, size, build date, installation date, platform, and other information.
·-L displays the file list in the software package.
·-S shows the status of all files in the software package.
·-D displays the list of files marked as documents (man manual, info manual, readmes, etc ).
·-C displays the list of files marked as configuration files. These are the files (sendmail. cf,
Passwd, inittab, etc ).
For the files to display the file list, you can add the-V command line option to get the output in the format of LS-L.
5. Verify the Software Package
The verification package is performed by comparing the installed files and the original file information in the package. Verification mainly compares the file size, MD5 verification code, File Permission, type, owner and user group.
The rpm-V command is used to verify a software package. You can use any package selection option to query the packages you want to verify. Command rpm-V foo
It will be used to verify the foo software package. Another example:
· Verify software packages that contain specific files:
Rpm-VF/bin/VI
· Verify all installed software packages:
Rpm-va
· Verify with an RPM package:
Rpm-VP foo-1.0-1.i386.rpm
If you are worried that your RPM database has been damaged, you can use this method.
If everything is verified normally, no output will be generated. If there is any inconsistency, it will be displayed. The output format is 8 characters long.
String, ''c refers to the configuration file, followed by each of the. 8 characters in the file name to represent the comparison of an attribute in the file and the RPM Database
Result. ''. (Point) indicates that the test has passed .. The following characters indicate a test failure on the RPM package:
Show character error source
5. MD5 Verification Code
S file size
L symbolic connection
T file modification date
D Device
U user
G User Group
M mode E (including permissions and file types)
If an error message is output, you should consider whether to delete the error or reinstall it to solve the problem.
6. teach you a trick
Rpm is not only a tool for installing/detaching programs, but also a good tool for system maintenance and diagnosis. After reading the following examples, you will learn about it.
It's amazing.
· If you accidentally delete some files, but you cannot delete them all, what should you do? You can type:
Rpm-va
Rpm will display the deletion of files on the screen. If you find that some files are lost or damaged, you can reinstall or uninstall them first.
Then install the software package.
· If you encounter a file you do not know, you can run the following command to find out which software package it belongs:
Rpm-qf/usr/x11r6/bin/xjewel
The output result is:
Xjewel-1.6-1
· If the above two examples are combined, for example, the file/usr/bin/paste has a problem. Which software package contains this document?
In this case, you can simply enter:
Rpm-VF/usr/bin/paste
· If you want to learn more about the program in use, you can enter the following command to obtain the documentation about the program in the software package:
Rpm-qdf/usr/bin/ispell
Output result:
/Usr/man/man4/ispell.4
/Usr/man/man4/english.4
/Usr/man/Man1/unsq.1
/Usr/man/Man1/tryaffix.1
/Usr/man/Man1/sq.1
/Usr/man/Man1/munchlist.1
/Usr/man/Man1/ispell.1
/Usr/man/Man1/findaffix.1
/Usr/man/Man1/buildhash.1
/Usr/INFO/ispell.info.gz
/Usr/doc/ispell-3.1.18-1/readme
· You have found a new koules rpm, but you do not know what it is. You can enter the following command:
Rpm-QIP koules-1.2-2.i386.rpm
· If you want to know which files are installed in the RPM package of koules, you can enter:
Rpm-qlp koules-1.2-2.i386.rpm output result:
/Usr/man/man6/koules.6
/Usr/lib/games/kouleslib/start. Raw
/Usr/lib/games/kouleslib/end. Raw
/Usr/lib/games/kouleslib/destroy2.raw
/Usr/lib/games/kouleslib/destroy1.raw
/Usr/lib/games/kouleslib/creator2.raw
/Usr/lib/games/kouleslib/creator1.raw
/Usr/lib/games/kouleslib/colize. Raw
/Usr/lib/games/kouleslib
/Usr/games/koules
The above are just a few common examples. With the further use of rpm, you will find that its combinations of various function options can achieve more powerful RPM package management functions.
Type text here