linux环境中,如何查看某个软件包,都依赖哪些软件包?被哪些软件包依赖?

2021年09月15日 阅读数:5
这篇文章主要向大家介绍linux环境中,如何查看某个软件包,都依赖哪些软件包?被哪些软件包依赖?,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。

需求描述:c++

  今天查看主机上的一个软件ghostscript,准备删除,就先看下这个软件都依赖哪些软件,api

  而后呢被哪些软件依赖bash

操做过程:ide

1.查看这个软件依赖哪些软件(rpm方式查询)测试

[root@testvm02 ~]# rpm -q ghostscript   #查看对应的rpm包.
ghostscript-8.70-19.el6.x86_64
[root@testvm02 ~]# rpm -qR ghostscript #R的意思就是requires就是依赖哪些软件包.
/bin/sh  
/sbin/ldconfig  
/sbin/ldconfig  
config(ghostscript) = 8.70-19.el6
ghostscript-fonts  
libICE.so.6()(64bit)  
libSM.so.6()(64bit)  
libX11.so.6()(64bit)  
libXext.so.6()(64bit)  
libXt.so.6()(64bit)  
libc.so.6()(64bit)  
libc.so.6(GLIBC_2.11)(64bit)  
libc.so.6(GLIBC_2.2.5)(64bit)  
libc.so.6(GLIBC_2.3)(64bit)  
libc.so.6(GLIBC_2.3.4)(64bit)  
libc.so.6(GLIBC_2.4)(64bit)  
libc.so.6(GLIBC_2.7)(64bit)  
libcairo.so.2()(64bit)  
libcom_err.so.2()(64bit)  
libcrypt.so.1()(64bit)  
libcups.so.2()(64bit)  
libcupsimage.so.2()(64bit)  
libdl.so.2()(64bit)  
libdl.so.2(GLIBC_2.2.5)(64bit)  
libfontconfig.so.1()(64bit)  
libgs.so.8()(64bit)  
libgssapi_krb5.so.2()(64bit)  
libjasper.so.1()(64bit)  
libjpeg.so.62()(64bit)  
libjpeg.so.62(LIBJPEG_6.2)(64bit)  
libk5crypto.so.3()(64bit)  
libkrb5.so.3()(64bit)  
libm.so.6()(64bit)  
libm.so.6(GLIBC_2.2.5)(64bit)  
libpng12.so.0()(64bit)  
libpng12.so.0(PNG12_0)(64bit)  
libpthread.so.0()(64bit)  
libpthread.so.0(GLIBC_2.2.5)(64bit)  
libpthread.so.0(GLIBC_2.3.2)(64bit)  
libstdc++.so.6()(64bit)  
libz.so.1()(64bit)  
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)  
urw-fonts >= 1.1
rpmlib(PayloadIsXz) <= 5.2-1

备注:以上查询出来的就是依赖的软件包.ui

2.经过yum方式来查询依赖的程序spa

[root@testvm02 ~]# yum deplist ghostscript
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Finding dependencies:
package: ghostscript.i686 8.70-19.el6
  dependency: libc.so.6(GLIBC_2.11) #依赖的库或者程序
   provider: glibc.i686 2.12-1.149.el6 #这个库是经过哪一个rpm包安装的.
  dependency: libXext.so.6
   provider: libXext.i686 1.3.2-2.1.el6
  dependency: libpng12.so.0
   provider: libpng.i686 2:1.2.49-1.el6_2
  dependency: libpng12.so.0(PNG12_0)
   provider: libpng.i686 2:1.2.49-1.el6_2
  dependency: libpthread.so.0(GLIBC_2.1)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libdl.so.2
   provider: glibc.i686 2.12-1.149.el6
  dependency: /sbin/ldconfig
   provider: glibc.x86_64 2.12-1.149.el6
   provider: glibc.i686 2.12-1.149.el6
  dependency: libkrb5.so.3
   provider: krb5-libs.i686 1.10.3-33.el6
  dependency: libdl.so.2(GLIBC_2.0)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libfontconfig.so.1
   provider: fontconfig.i686 2.8.0-5.el6
  dependency: libcrypt.so.1
   provider: glibc.i686 2.12-1.149.el6
  dependency: libICE.so.6
   provider: libICE.i686 1.0.6-1.el6
  dependency: libSM.so.6
   provider: libSM.i686 1.2.1-2.el6
  dependency: libpthread.so.0(GLIBC_2.0)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libcairo.so.2
   provider: cairo.i686 1.8.8-3.1.el6
  dependency: libcupsimage.so.2
   provider: cups-libs.i686 1:1.4.2-67.el6
  dependency: libjpeg.so.62
   provider: libjpeg-turbo.i686 1.2.1-3.el6_5
  dependency: libjasper.so.1
   provider: jasper-libs.i686 1.900.1-15.el6_1.1
  dependency: libz.so.1
   provider: zlib.i686 1.2.3-29.el6
  dependency: libstdc++.so.6
   provider: libstdc++.i686 4.4.7-11.el6
  dependency: libm.so.6
   provider: glibc.i686 2.12-1.149.el6
  dependency: rtld(GNU_HASH)
   provider: glibc.i686 2.12-1.149.el6
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: ghostscript-fonts
   provider: ghostscript-fonts.noarch 5.50-23.2.el6
  dependency: libjpeg.so.62(LIBJPEG_6.2)
   provider: libjpeg-turbo.i686 1.2.1-3.el6_5
  dependency: libcom_err.so.2
   provider: libcom_err.i686 1.41.12-21.el6
  dependency: urw-fonts >= 1.1
   provider: urw-fonts.noarch 2.4-10.el6
  dependency: /bin/sh
   provider: bash.x86_64 4.1.2-29.el6
  dependency: libdl.so.2(GLIBC_2.1)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libXt.so.6
   provider: libXt.i686 1.1.4-6.1.el6
  dependency: libX11.so.6
   provider: libX11.i686 1.6.0-2.2.el6
  dependency: libpthread.so.0(GLIBC_2.3.2)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libpthread.so.0
   provider: glibc.i686 2.12-1.149.el6
  dependency: libm.so.6(GLIBC_2.0)
   provider: glibc.i686 2.12-1.149.el6
  dependency: libgssapi_krb5.so.2
   provider: krb5-libs.i686 1.10.3-33.el6
  dependency: libcups.so.2
   provider: cups-libs.i686 1:1.4.2-67.el6
  dependency: libk5crypto.so.3
   provider: krb5-libs.i686 1.10.3-33.el6
package: ghostscript.x86_64 8.70-19.el6
  dependency: libcairo.so.2()(64bit)
   provider: cairo.x86_64 1.8.8-3.1.el6
  dependency: libstdc++.so.6()(64bit)
   provider: libstdc++.x86_64 4.4.7-11.el6
  dependency: libz.so.1()(64bit)
   provider: zlib.x86_64 1.2.3-29.el6
  dependency: libcupsimage.so.2()(64bit)
   provider: cups-libs.x86_64 1:1.4.2-67.el6
  dependency: /sbin/ldconfig
   provider: glibc.x86_64 2.12-1.149.el6
   provider: glibc.i686 2.12-1.149.el6
  dependency: libcrypt.so.1()(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: urw-fonts >= 1.1
   provider: urw-fonts.noarch 2.4-10.el6
  dependency: libm.so.6(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: /bin/sh
   provider: bash.x86_64 4.1.2-29.el6
  dependency: libX11.so.6()(64bit)
   provider: libX11.x86_64 1.6.0-2.2.el6
  dependency: libpng12.so.0(PNG12_0)(64bit)
   provider: libpng.x86_64 2:1.2.49-1.el6_2
  dependency: libk5crypto.so.3()(64bit)
   provider: krb5-libs.x86_64 1.10.3-33.el6
  dependency: libm.so.6()(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit)
   provider: libjpeg-turbo.x86_64 1.2.1-3.el6_5
  dependency: libXt.so.6()(64bit)
   provider: libXt.x86_64 1.1.4-6.1.el6
  dependency: libpng12.so.0()(64bit)
   provider: libpng.x86_64 2:1.2.49-1.el6_2
  dependency: libpthread.so.0(GLIBC_2.3.2)(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libfontconfig.so.1()(64bit)
   provider: fontconfig.x86_64 2.8.0-5.el6
  dependency: libdl.so.2()(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libICE.so.6()(64bit)
   provider: libICE.x86_64 1.0.6-1.el6
  dependency: libkrb5.so.3()(64bit)
   provider: krb5-libs.x86_64 1.10.3-33.el6
  dependency: libcom_err.so.2()(64bit)
   provider: libcom_err.x86_64 1.41.12-21.el6
  dependency: libXext.so.6()(64bit)
   provider: libXext.x86_64 1.3.2-2.1.el6
  dependency: libdl.so.2(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: ghostscript-fonts
   provider: ghostscript-fonts.noarch 5.50-23.2.el6
  dependency: rtld(GNU_HASH)
   provider: glibc.i686 2.12-1.149.el6
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libcups.so.2()(64bit)
   provider: cups-libs.x86_64 1:1.4.2-67.el6
  dependency: libc.so.6(GLIBC_2.11)(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libpthread.so.0()(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libgssapi_krb5.so.2()(64bit)
   provider: krb5-libs.x86_64 1.10.3-33.el6
  dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.149.el6
  dependency: libSM.so.6()(64bit)
   provider: libSM.x86_64 1.2.1-2.el6
  dependency: libjpeg.so.62()(64bit)
   provider: libjpeg-turbo.x86_64 1.2.1-3.el6_5
  dependency: libjasper.so.1()(64bit)
   provider: jasper-libs.x86_64 1.900.1-15.el6_1.1

3.查看这个软件被哪些软件依赖(即若是我要删除了会对哪些软件的运行有影响)code

[root@testvm02 ~]# rpm -q nfs-utils         #查看这个软件是否安装.
nfs-utils-1.2.3-54.el6.x86_64
[root@testvm02 ~]# rpm -e --test nfs-utils  #经过--test进行测试删除,查看是否有依赖关系,若是有会阻止删除.测试是否可以删除.
error: Failed dependencies:
    nfs-utils >= 1.2.1-11 is needed by (installed) nfs-utils-lib-1.1.5-9.el6.x86_64  #有其余的软件包依赖这个软件包,若是删除可能对这个程序有影响.
[root@testvm02 ~]# rpm -e --test nfs-utils
error: Failed dependencies:
    nfs-utils >= 1.2.1-11 is needed by (installed) nfs-utils-lib-1.1.5-9.el6.x86_64
[root@testvm02 ~]# rpm -e --test gcc  #测试删除gcc,没有报错,也就是没有别的地方依赖它,能够进行删除.
[root@testvm02 ~]# rpm -q gcc         #上面的--test并无真正删除
gcc-4.4.7-11.el6.x86_64
[root@testvm02 ~]# rpm -e gcc #不带--test参数,进行真正的删除.
[root@testvm02 ~]# rpm -q gcc #再次查询没有这个gcc已经被删除掉了.
package gcc is not installed

 

文档建立时间:2018年8月23日12:32:05blog