什么是RPM
RPM 全名 RedHat Package Managerment,是由Red Hat公司提出,被众多Linux发行版本所采用,是一种数据库记录的方式来将所需要的软件安装到到Linux系统的一套软件管理机制。
它会建立统一的数据库文件,详细记录软件包安装 、卸载等变化信息,能够自动分析软件包依赖关系
它最大的特点就是将你要安装的软件先编译过,并且打包成为 RPM 机制的文件,通过打包好的软件里面默认的数据库,记录这个软件要安装的时候必须具备的依赖属性软件。
当在你的 Linux 主机安装时,RPM 会先依照软件里面的数据查询Linux 主机的依赖属性软件是否满足,若满足则子以安装,若不满足则不子安装。那么安装的时候就将该软件的信息整个写入 RPM 的数据库中,以便未来的查询、验证与反安装。
优点:
由于已经编译完成井且打包完华,所以软件传输与安装上很方便(不需要再重新编译)。
RPM 在被安装之前,会先检查系统的硬盘容量、操作系统版本等,可避免文件被错误安装。
RPM 本身提供软件版本信息、依赖属性检查、软件用途说明、软件所含文件等信息;便于了解软件
RPM 管理使用数据库记录RPM文件的相关参数,便于查询、删除、升级与反安装。
缺点:
由于 RPM 文件是已经打包好的数据,也就是说,里面的数据已经都编译完成了,所以,该软件安装文件几乎只能安装在原本默认的硬件与操作系统版本中。所以你的主机系统环境必须要与当初建立这个软件安装文件的主机环境相同才行。
#rpm
作用:管理rpm包
语法:rpm 【选项】包名
因为rpm有的选项太多啦,所以我们要学会使用help,来查看不同选项的作用
bigboots@bigboots:~/Desktop$ 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
--whatconflicts query/verify the package(s) which require a dependency
--whatrequires query/verify the package(s) which require a dependency
--whatobsoletes query/verify the package(s) which obsolete a dependency
--whatprovides query/verify the package(s) which provide a dependency
--whatrecommends query/verify the package(s) which recommends a dependency
--whatsuggests query/verify the package(s) which suggests a dependency
--whatsupplements query/verify the package(s) which supplements a dependency
--whatenhances query/verify the package(s) which enhances 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
-A, --artifactfiles list all artifact 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
--force-debian force installation of rpm on Debian system
-F, --freshen=<packagefile>+ upgrade package(s) if already installed
-h, --hash print hash m