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] install all files, ignore the missing configuration items
-- allmatches [| = 0x2] to uninstall all matching packages. (If multiple packages are specified, an error message is generated.)
-- badreloc [| = 0x8] reposition the file in a non-Relocated package
-E, -- Erase = + uninstall package
-- excludedocs [| = 0x20] do not install the document
-- excludepath = ignore file with Guide Component
-- force [| = 0x74] -- replacepkgs -- shortcut for replacefiles
-F, -- freshen = + upgrade the package if it is already installed
-h, -- hash [| = 0x2]: hashes the installation package (preferably with the-V option)
-- ignorearch [| = 0x2] system without package verification
-- ignoreos [| = 0x1] operating system without package verification
-- ignoresize [| = 0x180] do not check disk space before installation
-- includedocs installation documentation
-- install = + installation package
-- justdb [| = 0x8] upgrade database, but do not modify the file system
-- nodeps does not verify the package dependency
-- noorder [| = 0x8] does not record the package installation information to the dependency
-- noscripts [| = 0xff0000] script for not executing the package
-- notriggers [| = 0x990000] No script triggered by the installation package
-- oldpackage [| = 0x40] upgrade to an old version of the package
(-- force upgrade, this operation is automatically executed)
-- percent [| = 0x1] prints the package installation progress
-- prefix = If relocation is allowed, then, the migration package is repackaged to the
-- relocate = from path to relocation file
-- repackage [| = 0x400]. The files of the unmounted package are repackaged and saved.
-- replacefiles [| = 0x30] Replace the installed files with the package file during installation
-- replacepkgs [| = 0x4] if the package already exists, then reinstall
-- test [| = 0x1] without the installation package, but check whether the package runs properly
-u, -- upgrade = + upgrade package

General options for all RPM modes:
-- version prints the version information of the RPM used
-- Quiet provides a small amount of detailed information output
-V, -- verbose provides more detailed information output
-- Define = ''use the value to define the macro
-- EVAL = + print + 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 lists all the installation/uninstallation scripts in the package
-- setperms sets file permissions in the package
-- setugids sets file user/group relationships in the package
-- conflicts to list the compatibility of this package
-- obsoletes to list the packages to be uninstalled when this package is installed
-- provides to list the compatibility of this package
-- requires to list this package required compatibility
-- info to list the description information in the package
-- changelog to list the change log of the package
-- triggers to list the trigger script in the package
-- last according installation time list package, recent priorities
-- filesbypkg: list all files of each package
-- redhatprovides: Find the package name based on the Compatibility provided by the package (the installation package rpmdb-RedHat is required)
-- r Edhatrequires searches for the package name based on the compatibility of the dependent package (requires the installation package rpmdb-RedHat)
-- buildpolicy = sets the package root directory (for example, the compressed man manual)
-- with = enable the packaging configuration
-- without = Disable the packaging configuration
help options:
-?, -- Help: displays the help information
-- Usage: displays usage summary
*********************** * *****************************
1. how can I not install but obtain files in the RPM package
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 extract, indicating that the file is extracted. V indicates that the execution process
D is the same as make-directory, indicating that the directory is created based on the original path of the file in the package
M indicates that the file update time is kept.

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 only want to know the executableProgramYou 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.