linux依赖包指的是什么

服务器   发布日期:2023年10月31日   浏览次数:636

这篇文章主要讲解了“linux依赖包指的是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“linux依赖包指的是什么”吧!

linux依赖包是指“库文件”,大部分依赖包都是一些库文件,有动态库也有静态库;Linux系统和其他操作系统一样,都是模块化的设计,也就是说功能互相依靠,有些功能需要一些其他功能来支撑,这样可以提高代码的可重用性。

什么是依赖包?为什么要下载依赖包?

Linux系统和其他操作系统一样,都是模块化的设计,也就是说功能互相依靠,有些功能需要一些其他功能来支撑,这样可以提高代码的可重用性:

大部分依赖包都是一些库文件,有动态库也有静态库,一个程序的依赖包如果没有安装,只安装了这个程序本身是不能使用

你可以理解为似windows的库文件,譬如DLL

比如我要装某个软件,这个软件又依赖于某个开发包,这个开发包包含这个软件所要运行的环境文件,这就是依赖关系。

再举个例子,比如我要去优酷看视频一样。

我就需要需要装flash。因为优酷的播放器是基于flash开发的。

如何查询我要安装的包所需要的依赖包?

这个时候就不得不用到一个特别普通的命令了,那就是rpm或者yum .

那如何查询呢?

1、通过rpm查询

  1. [root@testvm02 ~]# rpm -q ghostscript #查看对应的rpm包.
  2. ghostscript-8.70-19.el6.x86_64
  3. [root@testvm02 ~]# rpm -qR ghostscript #R的意思就是requires就是依赖哪些软件包.
  1. /bin/sh
  2. /sbin/ldconfig
  3. /sbin/ldconfig
  4. config(ghostscript) = 8.70-19.el6
  5. ghostscript-fonts
  6. libICE.so.6()(64bit)
  7. libSM.so.6()(64bit)
  8. libX11.so.6()(64bit)
  9. libXext.so.6()(64bit)
  10. libXt.so.6()(64bit)
  11. libc.so.6()(64bit)
  12. libc.so.6(GLIBC_2.11)(64bit)
  13. libc.so.6(GLIBC_2.2.5)(64bit)
  14. libc.so.6(GLIBC_2.3)(64bit)
  15. libc.so.6(GLIBC_2.3.4)(64bit)
  16. libc.so.6(GLIBC_2.4)(64bit)
  17. libc.so.6(GLIBC_2.7)(64bit)
  18. libcairo.so.2()(64bit)
  19. libcom_err.so.2()(64bit)
  20. libcrypt.so.1()(64bit)
  21. libcups.so.2()(64bit)
  22. libcupsimage.so.2()(64bit)
  23. libdl.so.2()(64bit)
  24. libdl.so.2(GLIBC_2.2.5)(64bit)
  25. libfontconfig.so.1()(64bit)
  26. libgs.so.8()(64bit)
  27. libgssapi_krb5.so.2()(64bit)

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

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

  1. [root@testvm02 ~]# yum deplist ghostscript
  1. Loaded plugins: product-id, subscription-manager
  2. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  3. Finding dependencies:
  4. package: ghostscript.i686 8.70-19.el6
  5. dependency: libc.so.6(GLIBC_2.11) #依赖的库或者程序
  6. provider: glibc.i686 2.12-1.149.el6 #这个库是通过哪个rpm包安装的.
  7. dependency: libXext.so.6
  8. provider: libXext.i686 1.3.2-2.1.el6
  9. dependency: libpng12.so.0
  10. provider: libpng.i686 2:1.2.49-1.el6_2
  11. dependency: libpng12.so.0(PNG12_0)
  12. provider: libpng.i686 2:1.2.49-1.el6_2
  13. dependency: libpthread.so.0(GLIBC_2.1)
  14. provider: glibc.i686 2.12-1.149.el6
  15. dependency: libdl.so.2
  16. provider: glibc.i686 2.12-1.149.el6

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

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

以上就是linux依赖包指的是什么的详细内容,更多关于linux依赖包指的是什么的资料请关注九品源码其它相关文章!