Use of RPM commands in Linux

Source: Internet
Author: User
Usage: rpm [option...]
Query options (parameter-Q or -- Query ):
-C, -- configfiles: list all configuration files
-D, -- docfiles: list all document files
-- Dump: Export basic file information
-L, -- list all files in the package
-- Queryformat = queryformat use the following Query format
-S, -- state: displays the status of the file list
-V, -- verbose displays the detailed file list
-A, -- all query/verify all packages
-F, -- file query/validation package containing files
-G, -- group query/check package in the group
-P, -- package query/verify a package file (for example, a binary *. RPM file)
-- Querytags: Display known query tags
-- Specfile
-- Whatrequires query/verify the dependency of a specified package
-- Whatprovides query/verify dependencies of a specified package

Check option (parameter-V or -- verify ):
-- Nomd5 [| = 0x1] does not use MD5 classification verification files
-- Nofiles [| = 0x10000] Do not verify the files in the package
-- Nodeps [| = 0x20000] does not verify the package dependency
-- NoScript [| = 0x40000] does not execute the validation script (any script)
-A, -- all query/verify all packages
-F, -- file query/check the files contained in the package
-G, -- group query/check package in the group
-P, -- package query/verify a package file (for example, a binary *. RPM file)
-- Querytags: Display known query tags
-- Specfile
-- Whatrequires query/verify the dependency of a specified package
-- Whatprovides query/verify dependencies of a specified package

Signature options:
-- Addsign adds a signature to the package
-- Resign a package (remove the current signature)
-K, -- checksig verify the package Signature
-- Nogpg [& = ~ 0x4] ignore any GPG Signature
-- Nomd5 [& = ~ 0x2] MD5 checksum of files not verified

Database options:
-- Initdb initializes the database
-- Rebuilddb re-creates the reverse list of the database from the header information of the installed package

Installation/upgrade/uninstall options:
-- Allfiles [| = 0x40]
-- Allmatches [| = 0x2] unmounts all matching packages. (If multiple packages are specified, an error message is generated)
-- Badreloc [| = 0x8] relocates a file in a non-Relocated package
-E, -- Erase = + uninstall the package
-- Excludedocs [| = 0x20] do not install the document
-- Excludepath = ignore file with bootstrap component
-- Force [| = 0x74] -- replacepkgs -- replacefiles shortcut
-F, -- freshen = + upgrade package when installed
-H, -- hash [| = 0x2]: hashes the installation package (preferably with the-V option)
-- Ignorearch [| = 0x2] system that does not verify the package
-- Ignoreos [| = 0x1] operating system that does not verify the package
-- Ignoresize [| = 0x180] disk space is not checked before installation
-- Includedocs installation document
-- Install = + installation package
-- Justdb [| = 0x8] upgrades the database without modifying the File System
-- Nodeps does not verify the package dependency
-- Noorder [| = 0x8] does not repeat the installation information of the new record package into the dependency
-- Noscripts [| = 0xff0000] script for not executing the package
-- Notriggers [| = 0x990000] does not execute any script triggered by the installation package.
-- Upgrade oldpackage [| = 0x40] to an old version of the package
(-- This operation is automatically executed during force upgrade)
-- Percent [| = 0x1] print the package installation progress
-- Prefix = If relocation is allowed, the packet is relocated
-- Relocate = from the path to the relocated file
-- Repackage [| = 0x400] repackage and save the unmounted package file.
-- Replacefiles [| = 0x30] Replace the installed files with the package file during installation
-- Replacepkgs [| = 0x4] if the package already exists, reinstall
-- Test [| = 0x1] does not install the installation package, but checks whether the package runs normally.
-U, -- upgrade = + upgrade package

Common options for all RPM modes:
-- Version: print the version of the RPM used.
-- Quiet provides a small amount of detailed information output
-V, -- verbose provides more detailed information output
-- Define = ''use values to define macros
-- EVAL = + printing + macro Extension
-R, -- root = use as the top-level directory (default :"/")
-- Macros = read to replace the default macro file
-- Rcfile = read to replace the default rpmrc File
-- Showrc displays the final rpmrc and macro configurations

Options implemented through popt alias/exec:
-- Scripts: list all installation/uninstall scripts in the package
-- Setperms: Set file permissions in the package
-- Setugids: Set the user/group relationship of the file in the package
-- Conflicts: list the compatibility of this package
-- Obsoletes: list the packages to be detached when this package is installed.
-- Provides: lists the compatibility provided by this package.
-- Requires: Compatibility required to list this package
-- Info: list the description information in the package
-- Changelog: lists the change logs of this package.
-- Triggers: List trigger scripts in the package
-- Last, packages are listed Based on the installation time. The latest time is preferred.
-- Filesbypkg: list all files in each package
-- Redhatprovides: Find the package name based on the provided compatibility (the installation package rpmdb-RedHat is required)
-- Redhatrequires: Find the package name based on the compatibility of the dependent package (the installation package rpmdb-RedHat is required)
-- Buildpolicy = set the root directory of the package (for example, the compressed man manual)
-- With = open the packaging Configuration
-- Without = Disable the packaging Configuration
Help options:
-?, -- Help: displays the help information.
-- Usage display usage Summary
**************************************** **************
1. How to get files in the RPM package without installing
Use tools rpm2cpio and cpio
Rpm2cpio XXX. RPM | cpio-vi
Rpm2cpio XXX. RPM | cpio-idmv
Rpm2cpio XXX. RPM | cpio -- extract -- make-Directories
The parameter I is the same as the extract parameter, indicating that the file is extracted. V indicates the execution process.
D is the same as make-Directory, which indicates creating a directory based on the original path of the file in the package.
M indicates the file update time.

2. How to view files and other information related to the RPM package
All of the examples below assume that the software package mysql-3.23.54a-11 is used
1. I installed those RPM packages in my system
Rpm-QA: list all installed packages
If you want to find all installed software packages that contain a string of SQL
Rpm-Qa | grep SQL

3. How to obtain the full name of a software package file
Rpm-Q MySQL can obtain the full name of the MySQL software package installed in the system.
The version of the current software package. The information mysql-3.23.54a-11 can be obtained in this example

4. Where is the file in an RPM package installed?
Rpm-QL package name
Note that the software package name does not include the. RPM suffix.
That is to say, you can only use MySQL or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm.
If you just want to know where the executable program is put, you can also use which, such
Which MySQL

5. files contained in an RPM package
For a software package that has not been installed, use rpm-qlp *****. rpm
You can also use rpm-QL *****. RPM to install a software package.

6. How can I obtain the version, usage, and other information about a software package?
For a software package that has not been installed, use rpm-QIP *****. rpm
You can also use rpm-Qi *****. RPM to install a software package.

7. Which software package is installed for a program or which package contains the program?
Rpm-QF 'which program name' returns the full name of the package
Rpm-QIF 'which program name' returns information about the software package.
Rpm-qlf 'which program name' returns the package file list
Note: here is not a quotation mark, but ', which is the key in the upper left corner of the keyboard.
You can also use rpm-qilf to output the package information and file list at the same time.

8. Which software package is installed for a file or which package contains the file?
Note that the method in the previous question only applies to executable programs. The following method is not only applicable
It is used for executable programs or common files. The premise is that you know the file name.
First obtain the complete path of the program, you can use whereis or which, and then use rpm-QF for example:
# Whereis ftptop
Ftptop:/usr/bin/ftptop/usr/share/man/Man1/ftptop.1.gz
# Rpm-qf/usr/bin/ftptop
Proftpd-1.2.8-1
# Rpm-qf/usr/share/doc/proftpd-1.2.8/RFC/rfc0959.txt
Proftpd-1.2.8-1

Summary:
To obtain information about the software package, use rpm-Q and Q to query the query. You can use other options, such
I indicates info to obtain information about the software package;
L indicates list to obtain the file list;
A Indicates all and queries are executed in all packages;
F indicates file, which can be queried Based on files;
P indicates the package, which is queried Based on the software package.
The required query conditions can be generated using grep or from the command line in ''.

9. Knowledge about RPM software packages
1. What is RPM?
RPM (RedHat package management) is one of the RedHat inventions.

10. Why RPM?
In an operating system, you must install software packages that implement various functions. These software packages generally have their own
Program, but there are also intricate dependencies. At the same time, we also need to solve the software package version and install it,
Configuration and uninstall automation issues. To solve these problems, RedHat puts forward
It is a good way to manage hundreds of thousands of software. This is the RPM management system. The RPM management system is installed in the system.
In the future, as long as it is a package that meets the RPM file standards, you can easily install, upgrade, uninstall

11. Is it true that all Linux systems use RPM?
Any system requires a package management system, so many Linux systems use the RPM System. However, the RPM System is dedicated for RH
However, systems such as TL and Mandrake also use rpm. Since RPM source programs can be compiled on other systems,
So it is possible to use rpm on other systems.
In addition to rpm, some other systems also have their own software package management programs, such as Debian's Deb package,
Slakware also has its own package management system.

12. Why is the file name of the RPM package so long?
The RPM package file name contains the version information, operating system information, and hardware requirements of the software package.
For example, the mypackage-1.1-2TL.i386.rpm where mypackage is the name of the software package registered in the system
1.1 indicates the software version number, 2 indicates the release number, Tl indicates the TL operating system, or RH. I386 indicates
It is used on intel X86 platforms, or it may be a type.

13. What does i686 and i386 in the package file name mean?
The RPM package file name contains not only the software name and version information, but also the applicable hardware architecture.
.
I386 indicates that this software package is applicable to computers with Intel 80386 or more x86 architectures (ai32)
I686 indicates that this software package is applicable to computers with x86 architectures (ia32) over intel 80686 (Pentium Pro and above)
Noarch indicates that this software package is not related to the hardware architecture and can be used in general.
The program of the i686 software package is usually optimized for the CPU, so backward compatibility is used for comparison.
It can be used on x86 machines. Forward is generally incompatible. However, there are very few CPUs under the Pentium Pro
Generally, the configured machine can use the i686 software package.

14. Can RPM packages released by different operating systems be mixed?
For RPM packages that have been compiled into binary files, they cannot be mixed due to different operating systems.
For software packages released with SRC. rpm, since local compilation is required during installation
Install it in the system.

15. Some special problems encountered when using rpm
Q I used rpm-e **. RPM to delete the RPM package.
Package A name does not include rpm,
Rpm-e package name, which can contain version numbers and other information, but cannot have a suffix. rpm

Q is there any tool for reading RPM files in MS?
A wincmd with RPM plugins .....

Q Can I install and upgrade the RPM package through FTP?
A can. Rpm-IVH ftp: // XXXXXXXX/path2somerpm

Q What if the version of the existing package is too high during RPM installation?
A sometimes because the installed software package is too old, and the related software package version in the system is relatively new, it may need
Some files dependent on the installed package cannot be found. There are two solutions,
First, find the file with the same or similar functions as the desired file in the system file and make a symbolic link
Directory.
The second is to download and install the new version of the software package.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.