如何找到 yum 安装的软件包?

如何找到 yum 安装的软件包?

我使用yum list php-imap列出 php-imap:

# yum list php-imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.zju.edu.cn
 * epel: ftp.cuhk.edu.hk
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.zju.edu.cn
 * webtatic: sp.repo.webtatic.com
Installed Packages
php-imap.x86_64                        5.4.16-7.el7                        @epel

但我怎样才能找到它的位置呢?我知道我可以用于find / -name php-imap搜索,但每次都很长,甚至命令都没有反应性。


在我的 CentOS 7 中,这/var/tmp/是一个空目录。并列出/var/cache/yum/x86_64/7/

base epel extras mysql56-community mysql-connectors-community mysql-tools-community timedhosts timedhosts.txt updates webtatic. 

没有php-imap

答案1

如果您想知道 rpm 文件在哪里,根据您的 yum 配置,您的系统可能会也可能不会保留它。检查 /etc/yum.conf(不确定这在所有系统上都是正确的位置,但在我的 Centos 机器上这是正确的位置)中的“cachedir=”行,这将告诉您 rpm 缓存的位置。例如:

grep cachedir /etc/yum.conf 

我的系统显示 /var/cache/yum/$basearch/$releasevar

在同一个文件中,如果包含 keepcache=0,您的系统将不会保存 rpm。将其更改为 keepcache=1 以保留它们。根据您的存储空间,您可能需要不时清理它。

如果您想知道系统上实际软件的位置,请执行以下操作:

rpm -qa | grep php-imap

然后从结果中获取包名称(看起来可能是 php-imap.x86_64)并执行此操作

rpm -q --filesbypkg <package full name here>

答案2

鉴于您的问题是关于使用安装的软件包yum,那么您必须检查选项infolist“子标志”。根据百胜人:

       info           Display details about a package or group of packages 
       list   Is used to list various information about available packages;

        LIST OPTIONS
       The following are the ways which you can invoke yum in list mode.  Note that all list commands include information on the version of the package.

       OUTPUT

              The format of the output of yum list is:

              name.arch [epoch:]version-release  repo or @installed-from-repo

              Note that if the repo cannot be determined, "installed" is printed instead.

       yum list [all | glob_exp1] [glob_exp2] [...]
              List all available and installed packages.

       yum list available [glob_exp1] [...]
              List all packages in the yum repositories available to be installed.

       yum list updates [glob_exp1] [...]
              List all packages with updates available in the yum repositories.

       yum list installed [glob_exp1] [...]
              List the packages specified by args.  If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.

       yum list extras [glob_exp1] [...]
              List the packages installed on the system that are not available in any yum repository listed in the config file.

       yum list distro-extras [glob_exp1] [...]
              List the packages installed on the system that are not available, by name, in any yum repository listed in the config file.

       yum list obsoletes [glob_exp1] [...]
              List the packages installed on the system that are obsoleted by packages in any yum repository listed in the config file.

       yum list recent
              List packages recently added into the repositories. This is often not helpful, but what you may really want to use is "yum list-updateinfo new" from the security yum plugin.

此外,已安装软件包的路径取决于您的系统设置:

在 Centos7 中

/var/tmp/yum-root-xxxxx/ 

或者

/var/tmp/yum-username-xxxxx/

或者

/var/cache/yum/x86_64/7/program_name/packages/

在 RHEL 中,文件存储在

/var/cache/yum/x86_64/6Server/rhel-6-server-rpms/packages/

相关内容