Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I download and install packages on my Red Hat Enterprise Linux Server 6 machine using YUM package manager in command-line mode.

When I install apk files on my Android phone, they go to /data/app directory, I am wondering where RHEL6 keeps its installed rpm files?

share|improve this question

2 Answers 2

Yum maintains a cache of the RPMs it downloads here:

/var/cache/yum/<you architecture>/<OS version>/

For example my box is Fedora 14, x86_64 architecture so I have the following:

$ ls /var/cache/yum/x86_64/14/
adobe-linux-i386        lamolabs                                  rpmfusion-nonfree
adobe-linux-x86_64      lamolabs-noarch                           rpmfusion-nonfree-debuginfo
Dropbox                 nautilus-flickr-uploader                  rpmfusion-nonfree-rawhide-debuginfo
fedora                  qm                                        rpmfusion-nonfree-source
...
...

But the RPMs that get installed are basically like a zip or tar file. So the contents of these files get dumped into the system and RPM maintains a database of what packages it has installed. The RPM "database" is located in this directory:

$ ls /var/lib/rpm
Basenames     __db.002  Dirnames     Installtid    Packages        Pubkeys         Sha1header
Conflictname  __db.003  Filedigests  Name          Providename     Requirename     Sigmd5
__db.001      __db.004  Group        Obsoletename  Provideversion  Requireversion  Triggername

You can see where files get installed per each RPM with these commands.

what files are in an installed RPM

$ rpm -ql rpm
/bin/rpm
/etc/rpm
/usr/bin/rpm2cpio
/usr/bin/rpmdb
/usr/bin/rpmquery
/usr/bin/rpmsign
/usr/bin/rpmverify
/usr/lib/rpm
/usr/lib/rpm/macros
/usr/lib/rpm/platform
/usr/lib/rpm/platform/amd64-linux
...
...

package info about a given RPM

$ rpm -qi rpm
Name        : rpm                          Relocations: (not relocatable)
Version     : 4.8.1                             Vendor: Fedora Project
Release     : 7.fc14                        Build Date: Tue 04 Oct 2011 03:49:08 AM EDT
Install Date: Tue 25 Oct 2011 09:36:34 AM EDT      Build Host: x86-05.phx2.fedoraproject.org
Group       : System Environment/Base       Source RPM: rpm-4.8.1-7.fc14.src.rpm
Size        : 2035701                          License: GPLv2+
Signature   : RSA/SHA256, Tue 04 Oct 2011 12:14:48 PM EDT, Key ID 421caddb97a1071f
Packager    : Fedora Project
URL         : http://www.rpm.org/
Summary     : The RPM package management system
Description :
The RPM Package Manager (RPM) is a powerful command line driven
package management system capable of installing, uninstalling,
verifying, querying, and updating software packages. Each software
package consists of an archive of files along with information about
the package like its version, a description, etc.
share|improve this answer

The rpm files themselves are downloaded and then installed. Once these files are installed, they are tracked by the rpm database. To see where the files for a particular rpm were installed, you can run rpm -ql.

E.g.

[z@localhost ~]# rpm -ql bash |head
/bin/bash
/bin/sh
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
/usr/bin/bashbug-64
/usr/share/doc/bash-4.1.2/COPYING
/usr/share/info/bash.info.gz
/usr/share/locale/af/LC_MESSAGES/bash.mo
/usr/share/locale/bg/LC_MESSAGES/bash.mo

Shows the first ten files installed by the bash rpm. That being said, rpms also contain pre and post scripts and some poorly built packages might drop files that wouldn't get tracked in the rpm database.

If that wasn't what you were asking, yum can cache rpms when downloading for an install. Try looking around in /var/cache/yum/ - but this only applies if you have keepcache=1 set in your /etc/yum.conf.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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