4

I use yum list php-imap list the 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

But how can I find the location of it? I know I can use find / -name php-imap for searching, but it is every long time, even the command do not have reactivity.


In my CentOS 7, the /var/tmp/ is an empty directory. and list the /var/cache/yum/x86_64/7/ are:

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

there is no php-imap.

2 Answers 2

4

If you want to know where the rpm file is, depending on your yum config your system may or may not keep it. Check /etc/yum.conf (not sure this is the right location on ALL systems but on my Centos box this is the right place) for the line "cachedir=" and this will tell you where the cache of rpms is located. For example:

grep cachedir /etc/yum.conf 

My system says /var/cache/yum/$basearch/$releasevar

In the same file, if keepcache=0 is included, your system will not save the rpms. Change this to keepcache=1 to keep them around. Depending on your storage space you might need to clean this up now and then.

If you want to know where the actual software is on your system, do this:

rpm -qa | grep php-imap

Then take the package name from the result (looks like it might be php-imap.x86_64) and do this

rpm -q --filesbypkg <package full name here>
3
  • 3
    This is correct for packages installed using rpm not yum!
    – user88036
    Sep 21, 2018 at 10:41
  • 1
    yum uses the same RPM installation database as yum, so the query commands will work nevertheless.
    – telcoM
    Sep 21, 2018 at 10:51
  • rpm -ql {package name} could help to locate, such as rpm -ql gperftools-libs-2.6.1-1.el7.x86_64 /usr/lib64/libprofiler.so.0 /usr/lib64/libprofiler.so.0.4.14 /usr/lib64/libtcmalloc.so.4 /usr/lib64/libtcmalloc.so.4.4.5 /usr/lib64/libtcmalloc_and_profiler.so.4 /usr/lib64/libtcmalloc_and_profiler.so.4.4.5 /usr/lib64/libtcmalloc_debug.so.4 /usr/lib64/libtcmalloc_debug.so.4.4.5 /usr/lib64/libtcmalloc_minimal.so.4 /usr/lib64/libtcmalloc_minimal.so.4.4.5 /usr/lib64/libtcmalloc_minimal_debug.so.4 /usr/lib64/libtcmalloc_minimal_debug.so.4.4.5
    – Just Do It
    Mar 10, 2021 at 15:38
2

Given that your question is about the packages installed using yum, then You have to check the options info and list "sub-flags". According to Yum man:

       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.

In Addition, the path to the installed packages depends on your system settings:

In Centos7

/var/tmp/yum-root-xxxxx/ 

or

/var/tmp/yum-username-xxxxx/

or

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

In RHEL, the files are stored in

/var/cache/yum/x86_64/6Server/rhel-6-server-rpms/packages/
3
  • In my CentOS 7, the /var/tmp/ is an empty directory. and list the /var/cache/yum/x86_64/7/ are: base epel extras mysql56-community mysql-connectors-community mysql-tools-community timedhosts timedhosts.txt updates webtatic. there is no php-imap. Sep 21, 2018 at 3:47
  • @fanhualuojin154873. Please see my edits above. Could be that your system was configured to remove the packages after installation. The response above is for packages installed by rpm your questions is about yum!
    – user88036
    Sep 21, 2018 at 10:41
  • yum is not a stand-alone tool, but basically a higher-level user interface for rpm
    – telcoM
    Sep 21, 2018 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.