Usage: rpm [OPTION...]
--quiet
-a, --all query/verify all packages #该命令通常与-q连用,如rpm -qa;rpm -qa |grep mysql;参见案例二,该rpm -qa;命令参数仅仅显示已经安装的rpm包列表。
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
-W, --ftswalk query/verify package(s) from TOP file tree walk
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--fileid query/verify package(s) with file identifier
--specfile query a spec file
--triggeredby query the package(s) triggered by the package
--whatrequires query/verify the package(s) which require a dependency
--whatprovides query/verify the package(s) which provide a dependency
--nomanifest do not process non-package files as manifests
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files,安装目录文件路径,如 rpm -qdmysql 参见案例三,-qd是-ql的子集。
--dump dump basic file information
-l, --list list files in package 列出目的安装包的安装在当前服务器中的所有文件路径列表,参见案例一。如 rpm -ql mysql #查看mysql的rpm包安装后的各个相关安装的文件的路径信息
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)
--comfollow follow command line symlinks
--logical logical walk
--nochdir don't change directories
--nostat don't get stat info
--physical physical walk
--seedot return dot and dot-dot
--xdev don't cross devices
--whiteout return whiteout information
--addsign sign package(s) (identical to --resign)
-K, --checksig verify package signature(s)
--delsign delete package signatures
--import import an armored public key
--resign sign package(s) (identical to --addsign)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--initdb initialize database
--rebuilddb rebuild database inverted lists from installed package headers
--aid add suggested packages to transaction
--allfiles install all files, even configurations which might otherwise be skipped
--allmatches remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)
--badreloc relocate files in non-relocatable package
-e, --erase=<package>+ erase (uninstall) package
--excludedocs do not install documentation
--excludepath=<path> skip files with leading component <path>
--fileconflicts detect file conflicts between packages
--force short hand for --replacepkgs --replacefiles
-F, --freshen=<packagefile>+ upgrade package(s) if already installed
-h, --hash print hash marks as package installs (good with -v)
--ignorearch don't verify package architecture
--ignoreos don't verify package operating system
--ignoresize don't check disk space before installing
-i, --install install package(s)
--justdb update the database, but do not modify the filesystem
--nodeps do not verify package dependencies
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files (obsolete)
--nocontexts don't install file security contexts
--noorder do not reorder package installation to satisfy dependencies
--nosuggest do not suggest missing dependency resolution(s)
--noscripts do not execute package scriptlet(s)
--notriggers do not execute any scriptlet(s) triggered by this package
--oldpackage upgrade to an old version of the package (--force on upgrades does this automatically)
--percent print percentages as package installs
--prefix=<dir> relocate the package to <dir>, if relocatable
--relocate=<old>=<new> relocate files from path <old> to <new>
--replacefiles ignore file conflicts between packages
--replacepkgs reinstall if the package is already present
--test don't install, but tell if it would work or not
-U, --upgrade=<packagefile>+ upgrade package(s),see Example 4.
-D, --define='MACRO EXPR' define MACRO with value EXPR
-E, --eval='EXPR' print macro expansion of EXPR
--macros=<FILE:...> read <FILE:...> instead of default file(s)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--rcfile=<FILE:...> read <FILE:...> instead of default file(s)
-r, --root=ROOT use ROOT as top level directory (default: "/")
--querytags display known query tags
--showrc display final rpmrc and macro configuration
--quiet provide less detailed output
-v, --verbose provide more detailed output
--version print the version of rpm being used
--scripts list install/erase scriptlets from package(s)
--setperms set permissions of files in a package
--setugids set user/group ownership of files in a package
--conflicts list capabilities this package conflicts with
--obsoletes list other packages removed by installing this package
--provides list capabilities that this package provides
--requires list capabilities required by package(s)
--info list descriptive information from package(s)
--changelog list change logs for this package
--xml list metadata in xml
--triggers list trigger scriptlets from package(s)
--last list package(s) by install time, most recent first
--dupes list duplicated packages
--filesbypkg list all files from each package
--fileclass list file names with classes
--filecolor list file names with colors
--fscontext list file names with security context from file system
--fileprovide list file names with provides
--filerequire list file names with requires
--filecaps list file names with POSIX1.e capabilities
-?, --help Show this help message
--usage Display brief usage message
/usr/bin/msql2mysql
/usr/bin/my_print_defaults
/usr/bin/mysql
/usr/bin/mysql_config
/usr/bin/mysql_find_rows
/usr/bin/mysql_waitpid
/usr/bin/mysqlaccess
/usr/bin/mysqladmin
/usr/bin/mysqlbinlog
/usr/bin/mysqlcheck
/usr/bin/mysqldump
/usr/bin/mysqlimport
/usr/bin/mysqlshow
/usr/bin/mysqlslap
/usr/lib64/mysql/mysql_config
/usr/lib64/mysql/mysqlbug
/usr/share/doc/mysql-5.1.73
/usr/share/doc/mysql-5.1.73/COPYING
/usr/share/doc/mysql-5.1.73/README
/usr/share/doc/mysql-5.1.73/README.mysql-docs
/usr/share/doc/mysql-5.1.73/README.mysql-license
/usr/share/man/man1/my_print_defaults.1.gz
/usr/share/man/man1/mysql.1.gz
/usr/share/man/man1/mysql_config.1.gz
/usr/share/man/man1/mysql_find_rows.1.gz
/usr/share/man/man1/mysql_waitpid.1.gz
/usr/share/man/man1/mysqlaccess.1.gz
/usr/share/man/man1/mysqladmin.1.gz
/usr/share/man/man1/mysqldump.1.gz
/usr/share/man/man1/mysqlshow.1.gz
/usr/share/man/man1/mysqlslap.1.gz
案例二:
mysql-libs-5.1.73-5.el6_6.x86_64
mysql-server-5.1.73-5.el6_6.x86_64
mysql-5.1.73-5.el6_6.x86_64
python-libs-2.6.6-52.el6.x86_64
basesystem-10.0-4.el6.noarch
bind-libs-9.8.2-0.23.rc1.el6_5.1.x86_64
libproxy-python-0.3.0-4.el6_3.x86_64
selinux-policy-3.7.19-231.el6_5.3.noarch
libreport-2.0.9-19.el6.centos.x86_64
glib2-2.26.1-7.el6_5.x86_64
abrt-addon-ccpp-2.0.8-21.el6.centos.x86_64
libcap-2.16-5.5.el6.x86_64
ethtool-3.5-1.4.el6_5.x86_64
abrt-addon-kerneloops-2.0.8-21.el6.centos.x86_64
dbus-libs-1.2.24-7.el6_3.x86_64
dracut-004-336.el6_5.2.noarch
neon-0.29.3-3.el6_4.x86_64
chkconfig-1.3.49.3-2.el6_4.1.x86_64
systemtap-runtime-2.3-4.el6_5.x86_64
libXau-1.0.6-4.el6.x86_64
expat-2.0.1-11.el6_2.x86_64
subversion-1.6.11-10.el6_5.x86_64
libXext-1.3.1-2.el6.x86_64
gawk-3.1.7-10.el6.x86_64
quota-3.17-21.el6_5.x86_64
libXi-1.6.1-3.el6.x86_64
shadow-utils-4.1.4.2-13.el6.x86_64
bind-utils-9.8.2-0.23.rc1.el6_5.1.x86_64
libXinerama-1.1.2-2.el6.x86_64
gdb-7.2-64.el6_5.2.x86_64
gtk2-2.20.1-4.el6.x86_64
sqlite-3.6.20-1.el6.x86_64
audit-2.2-4.el6_5.x86_64
gettext-devel-0.17-16.el6.x86_64
xmlrpc-c-1.16.24-1210.1840.el6.x86_64
lzo-2.03-3.1.el6_5.1.x86_64
policycoreutils-2.0.83-19.39.el6.x86_64
m4-1.4.13-5.el6.x86_64
man-pages-overrides-6.5.3-1.el6_5.noarch
libidn-1.18-2.el6.x86_64
glibc-2.12-1.149.el6_6.5.x86_64
device-mapper-1.02.79-8.el6.x86_64
libcap-ng-0.6.4-3.el6_0.1.x86_64
ntpdate-4.2.6p5-2.el6.centos.x86_64
kbd-1.15-11.el6.x86_64
libudev-147-2.51.el6.x86_64
--more--
案例三:
/usr/share/doc/mysql-server-5.1.73/my-huge.cnf
/usr/share/doc/mysql-server-5.1.73/my-innodb-heavy-4G.cnf
/usr/share/doc/mysql-server-5.1.73/my-large.cnf
/usr/share/doc/mysql-server-5.1.73/my-medium.cnf
/usr/share/doc/mysql-server-5.1.73/my-small.cnf
/usr/share/man/man1/innochecksum.1.gz
/usr/share/man/man1/msql2mysql.1.gz
/usr/share/man/man1/myisam_ftdump.1.gz
/usr/share/man/man1/myisamchk.1.gz
/usr/share/man/man1/myisamlog.1.gz
/usr/share/man/man1/myisampack.1.gz
/usr/share/man/man1/mysql.server.1.gz
/usr/share/man/man1/mysql_convert_table_format.1.gz
/usr/share/man/man1/mysql_fix_extensions.1.gz
/usr/share/man/man1/mysql_fix_privilege_tables.1.gz
/usr/share/man/man1/mysql_install_db.1.gz
/usr/share/man/man1/mysql_secure_installation.1.gz
/usr/share/man/man1/mysql_setpermission.1.gz
/usr/share/man/man1/mysql_tzinfo_to_sql.1.gz
/usr/share/man/man1/mysql_upgrade.1.gz
/usr/share/man/man1/mysql_zap.1.gz
/usr/share/man/man1/mysqlbinlog.1.gz
/usr/share/man/man1/mysqlbug.1.gz
/usr/share/man/man1/mysqlcheck.1.gz
/usr/share/man/man1/mysqld_multi.1.gz
/usr/share/man/man1/mysqld_safe.1.gz
/usr/share/man/man1/mysqldumpslow.1.gz
/usr/share/man/man1/mysqlhotcopy.1.gz
/usr/share/man/man1/mysqlimport.1.gz
/usr/share/man/man1/mysqlman.1.gz
/usr/share/man/man1/mysqltest.1.gz
/usr/share/man/man1/perror.1.gz
/usr/share/man/man1/replace.1.gz
/usr/share/man/man1/resolve_stack_dump.1.gz
/usr/share/man/man1/resolveip.1.gz
/usr/share/man/man8/mysqld.8.gz
/usr/share/man/man8/mysqlmanager.8.gz
Example 4:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm
Example 5:查看某个rpm包的安装信息
--info list descriptive information from package(s)
[root@localhost ~]# rpm -qi nginx
Name : nginx
Epoch : 1
Version : 1.18.0
Release : 1.el7.ngx
Architecture: x86_64
Install Date: Sun 02 Aug 2020 09:21:31 AM EDT
Group : System Environment/Daemons
Size : 2830028
License : 2-clause BSD-like license
Signature : RSA/SHA1, Tue 21 Apr 2020 11:19:18 AM EDT, Key ID abf5bd827bd9bf62
Source RPM : nginx-1.18.0-1.el7.ngx.src.rpm
Build Date : Tue 21 Apr 2020 11:07:33 AM EDT
Build Host : ip-10-1-17-101.eu-central-1.compute.internal
Relocations : (not relocatable)
Vendor : Nginx, Inc.
URL : http://nginx.org/
Summary : High performance web server
Description :
nginx [engine x] is an HTTP and reverse proxy server, as well as
a mail proxy server.
[root@localhost ~]#