必威体育Betway必威体育官网
当前位置:首页 > IT技术

Linux中使用rpm命令安装rpm包

时间:2019-06-12 05:44:14来源:IT技术作者:seo实验室小编阅读:88次「手机版」
 

rpm 安装

安装软件包命令,参数指明了( v 展示正在安装的文件信息  

1 #rpm -i example.rpm 安装 example.rpm 包;
2 #rpm -iv example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息;
3 #rpm -ivh example.rpm 安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度
rpm -ivh your_package_name

如:rpm -ivh jdk-8u111-linux-x64.rpm

参考来源:https://www.cnblogs.com/dadonggg/p/8191390.html 

rpm 常用命令
1.安装一个包 (展示正在安装的文件信息以及安装进度)
# rpm -ivh 

2.升级一个包 
# rpm -Uvh 

3.卸载一个包 
# rpm -e 

4.安装参数 
--force 即使覆盖属于其它包的文件也强迫安装 
--nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。 

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>

12.解压RPM包

有时我们需要RPM包中的某个文件,如何解压RPM包呢?

RPM包括是使用cpio格式打包的,因此可以先转成cpio然后解压,如下所示:

rpm2cpio xxx.rpm | cpio -p

关于rpm相关命令的帮助放在下方:

[root@localhost-11 opt]# 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

相关阅读

weblogic 安装部署详解

0x01 weblogic下载安装去Oracle官网下载Weblogic 10.3.6,选择Generic版本,各版本选择下载地址:http://www.oracle.com/technetwo

Ubuntu安装和配置ssh教程

一般Ubuntu都会默认安装openssh-client,但是没有安装openssh-server。 安装ssh服务器 sudo apt install openssh-server 安装

Matlab R2017a 中文版下载安装与破解图文教程

下面带来win7 64-bit  Matlab 2017a的安装过程,亲测,可用。(一)所需文件及下载地址1.Matlab-R2017a-ISO镜像文件链接:https://pan.bai

Shadowrocket【小火箭】安装方法

Shadowrocket 俗称小火箭,它是一款用来帮助我们学习的工具,比如到Google去查询一些学习资料.....,懂的小伙伴就可以忽略此处的介绍

最新超详细VMware虚拟机下载与安装

作者: seriouszyx独立博客记录了日常学习总结代码均可在 Github上找到(求Star) VMware下载与安装 一、虚拟机的下载 1.进入VMwar

分享到:

栏目导航

推荐阅读

热门阅读