rpm 与 yum 常用查询功能

[TOC]

例如查询ceph rados 命令的依赖包

ldd /usr/bin/rados |awk '{print $3}'|grep '^/' |xargs -i  rpm -qf {}|xargs -i rpm -qi {} |grep ceph -B 10 -A 10

rpm 查询

rpm -qf 查询文件来源于那个package

[root@localhost ~]# rpm -qf /usr/bin/rados
ceph-common-10.2.10-0.el7.x86_64

rpm -qi 查询rpm package 信息

rpm -qi ceph-common
Name        : ceph-common
Epoch       : 1
Version     : 10.2.10
Release     : 0.el7
Architecture: x86_64
Install Date: Sat 23 May 2020 04:12:25 PM CST
Group       : System Environment/Base
Size        : 62321887
License     : LGPL-2.1 and CC-BY-SA-1.0 and GPL-2.0 and BSL-1.0 and GPL-2.0-with-autoconf-exception and BSD-3-Clause and MIT
Signature   : RSA/SHA1, Mon 13 Nov 2017 05:33:12 PM CST, Key ID d4a2e50be451e5b5
Source RPM  : ceph-10.2.10-0.el7.src.rpm
Build Date  : Wed 18 Oct 2017 11:04:07 PM CST
Build Host  : c1bj.rdu2.centos.org
Relocations : (not relocatable)
Packager    : CBS <cbs@centos.org>
Vendor      : CentOS
URL         : http://ceph.com/
Summary     : Ceph Common
Description :
Common utilities to mount and interact with a ceph storage cluster.
Comprised of files that are common to Ceph clients and servers.

rpm -qR 查询package 依赖

[root@localhost ~]# rpm -qR ceph-common
/bin/bash
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/usr/bin/env
config(ceph-common) = 1:10.2.10-0.el7
ld-linux-x86-64.so.2()(64bit)
ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
libbabeltrace-ctf.so.1()(64bit)
libbabeltrace.so.1()(64bit)
libblkid.so.1()(64bit)
libblkid.so.1(BLKID_1.0)(64bit)
...

rpm -qa 查找所以

[root@localhost ~]# rpm -qa |grep ceph
centos-release-ceph-jewel-1.0-1.el7.centos.noarch
libcephfs1-10.2.10-0.el7.x86_64
python-cephfs-10.2.10-0.el7.x86_64
ceph-common-10.2.10-0.el7.x86_64

rpm -q

[root@localhost ~]# rpm -q ceph-common
ceph-common-10.2.10-0.el7.x86_64
[root@localhost ~]# rpm -q ceph-common-10.2.10-0.el7.x86_64
ceph-common-10.2.10-0.el7.x86_64
[root@localhost ~]# rpm -q ceph-common-10.2.10-0.el7
ceph-common-10.2.10-0.el7.x86_64

yum 查询

yum 查询软件可用版本

[root@localhost ~]# yum list ceph-common --showduplicates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * centos-qemu-ev: mirrors.ustc.edu.cn
 * extras: mirrors.dgut.edu.cn
 * updates: mirrors.dgut.edu.cn
Installed Packages
ceph-common.x86_64      1:10.2.10-0.el7  @centos-ceph-jewel
Available Packages
ceph-common.x86_64      1:10.2.5-4.el7   base
ceph-common.x86_64      1:10.2.7-0.el7   centos-ceph-jewel
ceph-common.x86_64      1:10.2.10-0.el7  centos-ceph-jewel

yum 查询软件需要的依赖

[root@localhost ~]#  yum deplist ceph-common

Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * centos-qemu-ev: mirrors.ustc.edu.cn
 * extras: mirrors.dgut.edu.cn
 * updates: mirrors.dgut.edu.cn
package: ceph-common.x86_64 1:10.2.10-0.el7
  dependency: /bin/bash
   provider: bash.x86_64 4.2.46-34.el7
  dependency: /bin/sh
   provider: bash.x86_64 4.2.46-34.el7
  dependency: /usr/bin/env
   provider: coreutils.x86_64 8.22-24.el7_9.2
  dependency: ld-linux-x86-64.so.2()(64bit)
   provider: glibc.x86_64 2.17-324.el7_9
  dependency: ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
   provider: glibc.x86_64 2.17-324.el7_9

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.