码迷,mamicode.com
首页 > 其他好文 > 详细

rpm 命令详解

时间:2017-04-02 00:41:25      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:context   meta   ext   atp   lead   nod   rmi   package   res   

rpm命令是RPM软件包的管理工具。

RPM有多种基本的模式:它们是安装、查询、验证、删除等。

安装模式:rpm –i

查询模式:rpm -q

验证模式:rpm –V或 -verify

删除模式:rpm –e

1.安装一个包

rpm -ivh

2.升级一个包

rpm -Uvh

3.移走一个包

rpm -e

4.安装参数

--force 即使覆盖属于其它包的文件也强迫安装

--nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。

rpm -ivh *.rpm --nodeps --force

5.查询一个包是否被安装

rpm -q < rpm package name>

6.得到被安装的包的信息

rpm -qi < rpm package name>

7.列出该包中有哪些文件

rpm -ql < rpm package name>

8.列出服务器上的一个文件属于哪一个RPM包

rpm -qf

9.可综合好几个参数一起用

rpm -qil < rpm package name>

10.列出所有被安装的rpm package

rpm -qa

11.列出一个未被安装进系统的RPM包文件中包含有哪些文件?

rpm -qilp < rpm package name>
[root@script ~]# rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
  -a, --all                        query/verify all packages                     #查询/验证所有包
  -f, --file                       query/verify package(s) owning file           #查询/验证包(拥有)文件
  -g, --group                      query/verify package(s) in group
  -p, --package                    query/verify a package file
  --pkgid                          query/verify package(s) with package identifier
  --hdrid                          query/verify package(s) with header identifier
  --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

Query options (with -q or --query):
  -c, --configfiles                list all configuration files
  -d, --docfiles                   list all documentation files
  -L, --licensefiles               list all license files
  --dump                           dump basic file information
  -l, --list                       list files in package
  --queryformat=QUERYFORMAT        use the following query format
  -s, --state                      display the states of the listed files

Verify options (with -V or --verify):
  --nofiledigest                   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)

Install/Upgrade/Erase options:
  --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> 
  --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
  --nocontexts                     don‘t install file security contexts
  --noorder                        do not reorder package installation to satisfy dependencies
  --noscripts                      do not execute package scriptlet(s)
  --notriggers                     do not execute any scriptlet(s) triggered by this package
  --nocollections                  do not perform any collection actions
  --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)

Common options for all rpm modes and executables:
  -D, --define=‘MACRO EXPR‘        define MACRO with value EXPR
  --undefine=MACRO                 undefine MACRO
  -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: "/")
  --dbpath=DIRECTORY               use database in DIRECTORY
  --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

Options implemented via popt alias/exec:
  --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 options:
  -?, --help                       Show this help message
  --usage                          Display brief usage message

rpm 命令详解

标签:context   meta   ext   atp   lead   nod   rmi   package   res   

原文地址:http://www.cnblogs.com/xieshengsen/p/6657991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!