rpm工具

rpm 命令:

介绍: redhat package manager :CentOS中包管理工具

  • -ivh :安装rpm包

  • -i :安装

  • -v :可视

  • -h :进度

  • --nodeps :忽略依赖关系,直接安装

  • --force :覆盖原有包

  • -U :升级包

  • -e :卸载

在安装时经常遇到包之间的依赖关系,根据提示安装

但也存在两个包之间相互依赖,我们可以通过同时安装两个包

安装和升级要写包的完整名 卸载只要加包名

  • -qa 包名 :查询安装过的rpm包

  • -qi 包名 :查询安装的rpm详细信息

  • -ql 包名 :查询rpm包的安装文件

  • -qf 文件绝对路径:查看文件时有哪个包安装,和which配合使用

    rpm -qf `which vim`

[root@localhost ~]# rpm -ivh httpd-2.4.6-80.el7.centos.1.x86_64.rpm 
准备中...                          ################################# [100%]
        软件包 httpd-2.4.6-80.el7.centos.1.x86_64 已经安装
[root@localhost ~]# rpm -e httpd
[root@localhost ~]# rpm -ivh httpd-2.4.6-80.el7.centos.1.x86_64.rpm 
准备中...                          ################################# [100%]
正在升级/安装...
   1:httpd-2.4.6-80.el7.centos.1      ################################# [100%]
[root@localhost ~]# rpm -qi httpd
Name        : httpd
Version     : 2.4.6
Release     : 80.el7.centos.1
Architecture: x86_64
Install Date: 2018年08月04日 星期六 20时01分45秒
Group       : System Environment/Daemons
Size        : 9817285
License     : ASL 2.0
Signature   : RSA/SHA256, 2018年07月03日 星期二 22时31分55秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : httpd-2.4.6-80.el7.centos.1.src.rpm
Build Date  : 2018年06月27日 星期三 21时50分38秒
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://httpd.apache.org/
Summary     : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
[root@localhost ~]# rpm -qa httpd
httpd-2.4.6-80.el7.centos.1.x86_64

最后更新于

这有帮助吗?