Yum user temp files (/var/tmp/yum*) fills up with repo data

rhelrpmtmpyum

On my rhel6 system, non-sudo users can do yum check-update. Files are then placed in /var/tmp/yum[user]*/ . The repodata there gets quite large. Can I:

  1. Configure the location?
  2. Configure yum so it removes old files?

My /var/tmp/yum-nrpe*/x86_64/6Server looks contains the following:

28M     el-6-epel/5f32b55aa431745fe8b48deb2e0083a6507d19abbc29562a2e2b01b70ef93ada-primary.sqlite
29M     el-6-epel/89f1177c1b9f003409e2f5a91f7f3074a4b8e162376ffab286a35b8221e0a308-primary.sqlite
29M     el-6-epel/b98f6809469e5de3a13a5b251c5d35c622baecb9f3c593804245c443ace9a224-primary.sqlite
29M     el-6-epel/c79dd64a4e4aa8fb160353e9cd9d8e10120f5402a18aca730ae860d07f52bda3-primary.sqlite
29M     el-6-epel/e4b306d444fcfb361f7f2aace64a3ef67c8bd7fd1cbd251e64f150096f2f1ba9-primary.sqlite
1.2M    el-6-comp-extra/6c04e2f2f68bc085d529d857dd6c0539ff23d5139d2be21565dac3d8e586bae0-primary.sqlite
15M     rhel-6-server-optional-rpms/2469dd815fb83f3667f043cf3098a487a13ac6955ea36b2349bdc3a2ee1e20d2-primary.sqlite
15M     rhel-6-server-optional-rpms/bf8ce73943e4c78fc4205924fbfaf20ec4bcb72757f03366ec1245ffe2e0803e-primary.sqlite
15M     rhel-6-server-optional-rpms/e4f6cad281229297c712f8dd828c2062f8fbc02c6be215ea0df35059e98b4a5d-primary.sqlite
124M    rhel-6-server-rpms/5a411e3bf6a743656636e6baaec1680eec3480cf69acb79aad11c535862f2787-primary.sqlite
124M    rhel-6-server-rpms/60daa8229ca2386d6c7f319ce1fd819a46109e0b7a42c90e48acde23c3b200f6-primary.sqlite
124M    rhel-6-server-rpms/8592d0cd0b2e358c7850dee130497cb8969a72b9ac28cddc13a054caccee6d65-primary.sqlite
124M    rhel-6-server-rpms/f5798fe075da31815c5e43356a10c208af55a972b61fea37d63ea6edb3a78cae-primary.sqlite

Best Answer

When you run yum under not privileged user it uses as a cache directory the directory /var/tmp or what is set by the shell variable TMPDIR. So you can change the default behavior by running yum like this:

TMPDIR=/tmp yum check-update
TMPDIR=/tmp yum makecache

The same way you can run yum to clean up the cache directory:

TMPDIR=/tmp yum clean metadata
TMPDIR=/tmp yum clean all

When you use clean all option, ignore the warnings about rpmdb files as the user doesn't have priviledges to do so.

Finally, you can export the TMPDIR variable to not use it repeatedly when running yum:

export TMPDIR=/tmp
yum check-update
yum clean metadata
Related Question