Linux rpm package usage guide

zhaozj2021-02-16  126

Linux RPM package Guide (Author: Sword_martin 2001 Nian 04 Yue 09 Ri 17:42) usually Linux application software package is installed, there are three: tar package, rpm package and dpkg package. The RPM package mainly mentioned in this paper is a packaged format provided by Redhat Linux. RPM has five basic operations (excluding creation packages): Installation, uninstall, upgrade, query, and verification. Let's explain one by one. First, install the RPM package RPM package usually has a file name similar to FOO-1.0-1.i386.rpm. These include the name of the package (foo), version number (1.0), the issuance number (1), and the hardware platform (I386). Installing a package simply typing the following command: $ rpm -ivh foo-1.0-1.i386.rpm foo ####################### ############# The name of the package will be printed after the installation is completed (not necessarily the same as the file name), and then print a series of ## to indicate the installation progress. Although the installation of the package is designed as simple as possible, it is possible to happen: 1. The package has been installed if your package has been installed, will appear: $ 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 need to install the package, you can use the --ReplacePKGS option on the command line RPM will ignore the error message forcibly installation. 2, file conflicts If you have a file in the package you want to install, there is a file that is installed when you install other packages, the following error message will appear: # 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 allow RPM to ignore the error message, use the --ReplaceFiles command line option. 3, unresolved RPM software package may depend on other packages, that is, the package can be installed after the specific package is installed. If there is such an unresolved dependency when you install a package. The following information is produced: $ rpm -ivh bar-1.0-1.i386.rpm failed dependencies: foo is needed by bar-1.0-1 You must install the redeered package to solve this problem. If you want to force installation (this is a bad idea, because the installed package is not necessarily running normally), use the --Node Pro command line option. Second, uninstalling the RPM package unloading package is as simple as installing the package: $ rpm -e foo Note that this name "foo" using the package is used, not the name of the package file "foo-1.0-1.i386 . rpm. If other packages rely on packages you want to uninstall, error messages are generated when uninstalling. Such as: $ rpm -e foo removing the package: foo is needed by bar-1.0-1 If you let RPM ignore this error continues to uninstall (this is not a good idea, because the program depends on the package may not be able to run Please use the --Nodeps command line option.

Third, upgrade RPM package upgrade package and installation package very similar: $ rpm -uvh foo-2.0-1.i386.rpm foo ########################### ############### RPM automatically uninstall the installed boss's Foo package, you won't see the information. In fact, you may always use -U to install the package, because even if the package is not installed, you can run it normally. Because RPM performs intelligent packages upgrade, automatically handle the configuration file, you will see the following information: saving /etc/foo.conf as /etc/foo.conf.rpmsave This means that you don't have to modify the configuration file Up is compatible. Therefore, RPM will back up the old file and install new files. You should resolve the differences between these two configuration files as soon as possible so that the system can run normally. Since the upgrade actually includes the uninstall and installation of the package, you may encounter an error caused by these two operations. Another problem that you may encounter is: When you use the old version of the package to upgrade the new version of the software, RPM produces 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, join the - keldPackage command option. Fourth, query The installed package uses the command RPM -Q to query the installed package database. Simple usage command RPM -Q Foo will print the package name, version number, and issued number of the Foo package: $ rpm -q foo foo -2.0-1 In addition to the specified software package name, you can also use the following options to specify which packages you want to query. These options are called "package specified options". ● -a query all installed packages ● -f The package contains the package containing the file ● -p Query Package File Name can also specify the information displayed when the package is queried. They were Called with information selection options: ● -i display package information, such as description, issuing number, size, build date, installation date, platform, and other information. ● -L Displays a list of files in the package. ● - - s The status of all files in the package. ● -D Displays a list of files that are labeled as documents (MAN Manual, Info Manual, ReadMe's, etc). ● -c Displays a list of files labeled as profiles. These are you want Documents that are customized after installation (Sendmail.cf, Passwd, InitTab, etc). For files to display file list, you can add the -v command line option to get the output as the LS -L format. 5. Verification The package verification package is performed by comparing the original file information in the installed file and package. Verification is mainly comparable to the size, MD5 check code, file privilege, type, home and user group, etc. RPM -V command to verify a package. You can use any package selection option to query the package you want to verify. Command rpm -v foo will be used to verify the Foo package. Another example: ● Verify packages containing specific files : Rpm -vf / bin / VI; ● Verify all installed packages: rpm -va; ● Verify it according to an RPM package: rpm -vp foo-1.0-1.i386.rpm. This approach can be used if you are worried that your RPM database has been destroyed. If everything is verified, no output will be generated.

If there is inconsistent place, it will be displayed. The output format is an 8-bit long string, "c" is used to refer to the configuration file, followed by the file name. Each of the 8-bit character is used to represent a comparison result of an attribute in the file and the RPM database. "." (Point) indicates the test. The following characters indicate some test failure to the RPM package: Display Character Error Source 5 MD5 Queode S File Size L Symbol Connection T File Modification Date D Device U User G User Group M Mode E (including permissions and file type If there is an error message output, you should consider that it is to solve the problem by deleting or reinstalling. Sixth, teach you a trick rpm not only the tool for installing / uninstalling the program, it is still a good hand of system maintenance and diagnosis. I have seen the following examples you will teach it. ● If you accidentally delete some files, you can't definitely delete those files, what should I do? You can type: rpm -va. RPM will display the file deletion on the screen. If you find that some files are lost or have been corrupted, you can reinstall or uninstall and install the package. ● If you have encountered a file you don't know, if you want to investigate which package it belongs to it, you can enter the following command: rpm -qf / usr / x11r6 / bin / xjewel output result will be: xjewel-1.6-1. ● If there are two examples of integrated or more, such as file / usr / bin / paste have problems. You want to know which package contains this file, you can type in this time: rpm -vf / usr / bin / paste.

转载请注明原文地址:https://www.9cbs.com/read-8844.html

New Post(0)