RPM软件包管理器(RPM Package Manager)rpm原本是Red Hat Linux发行版专门用来管理Linux各项套件的程序,由于它遵循GPL规则且功能强大方便,因而广受欢迎,逐渐受到其他发行版的采用。rpm让Linux软件的安装、升级更加简单。
rpm常用命令
我们以安装“zwina.co.rpm”这个软件包为例
安装软件包:rpm -ivh zwina.co.rpm
;
升级软件包:rpm -Uvh zwina.co.rpm
;
移走软件包:rpm -e zwina.co.rpm
;
获取安装包信息:rpm -ql
列出服务器上的一个文件属于哪一个RPM包:rpm -qf
列出所有被安装的rpm package:rpm -qa
列出一个未被安装进系统的RPM包文件中包含有哪些文件:rpm -qilp
rpm命令选项
-a:查询所有套件;
-b<完成阶段><套件档>+或-t <完成阶段><套件档>+:设置包装套件的完成阶段,并指定套件档的文件名称;
-c:只列出组态配置文件,本参数需配合”-l”参数使用;
-d:只列出文本文件,本参数需配合”-l”参数使用;
-e<套件档>或–erase<套件档>:删除指定的套件;
-f<文件>+:查询拥有指定文件的套件;
-h或–hash:套件安装时列出标记;
-i:显示套件的相关信息;
-i<套件档>或–install<套件档>:安装指定的套件档;
-l:显示套件的文件列表;
-p<套件档>+:查询指定的RPM套件档;
-q:使用询问模式,当遇到任何问题时,rpm指令会先询问用户;
-R:显示套件的关联性信息;
-s:显示文件状态,本参数需配合”-l”参数使用;
-U<套件档>或–upgrade<套件档>:升级指定的套件档;
-v:显示指令执行过程;
-vv:详细显示指令执行过程,便于排错。
rpm –help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | [root@aliyunbaike ~]# rpm –help Usage: rpm [OPTION...] —quiet 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 –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 Query options (with –q or —query): –c, —configfiles list all configuration files –d, —docfiles list all documentation 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 –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) File tree walk options (with –ftswalk): –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 Signature options: —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) Database options: —initdb initialize database —rebuilddb rebuild database inverted lists from installed package headers Install/Upgrade/Erase options: —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) Common options for all rpm modes and executables: -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 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 |