From Fedora Project Wiki
fp-wiki>ImportUser
(Imported from MoinMoin)
 
m (add cat)
 
(3 intermediate revisions by 2 users not shown)
Line 11: Line 11:
By default, <code>yum</code> stores temporary files under the directory <code>/var/cache/yum/</code>, with one subdirectory for each configured repository. The <code>packages/</code> directory within each repository directory holds the cached packages. For example, the directory <code>/var/cache/yum/development/packages/</code> holds packages downloaded from the development repository.
By default, <code>yum</code> stores temporary files under the directory <code>/var/cache/yum/</code>, with one subdirectory for each configured repository. The <code>packages/</code> directory within each repository directory holds the cached packages. For example, the directory <code>/var/cache/yum/development/packages/</code> holds packages downloaded from the development repository.


{| border="1"
{{Admon/tip | Clearing the <code>yum</code> Caches | Cached files use disk space until removed. You may wish to periodically clear the <code>yum</code> caches to recover capacity. Refer to [[Docs/Drafts/SoftwareManagementGuide/YumCaching#clearing_the_yum_caches| Section 10.3, “Clearing the yum Caches”]]  for information on clearing the caches.}}
|-
| {{Template:Tip}} '''Clearing the <code>yum</code> Caches'''
|-
| Cached files use disk space until removed. You may wish to periodically clear the <code>yum</code> caches to recover capacity. Refer to [[Docs/Drafts/SoftwareManagementGuide/YumCaching/#clearing_the_yum_caches| Section 10.3, “Clearing the yum Caches”]]  for information on clearing the caches.
|}


If you remove a package from the cache, you do not affect the copy of the software installed on your system.
If you remove a package from the cache, you do not affect the copy of the software installed on your system.
Line 24: Line 19:


To configure <code>yum</code> to retain downloaded files rather than discarding them, set the <code>keepcache</code> option in <code>/etc/yum.conf</code> to <code>1</code>:
To configure <code>yum</code> to retain downloaded files rather than discarding them, set the <code>keepcache</code> option in <code>/etc/yum.conf</code> to <code>1</code>:


<code>keepcache=1</code>
<code>keepcache=1</code>


Refer to [[Docs/Drafts/SoftwareManagementGuide/CustomizingYum/#editing_the_yum_configuration| Section 9.1, “Editing the yum Configuration”]]  for more information on editing the <code>yum</code> configuration file.
Refer to [[Docs/Drafts/SoftwareManagementGuide/CustomizingYum#editing_the_yum_configuration| Section 9.1, “Editing the yum Configuration”]]  for more information on editing the <code>yum</code> configuration file.


Once you enable caching, every <code>yum</code> operation may download package data from the configured repositories. To ensure that the caches have a set of package data, carry out an operation after you enable caching. Use a list or search query to download package data without modifying your system.
Once you enable caching, every <code>yum</code> operation may download package data from the configured repositories. To ensure that the caches have a set of package data, carry out an operation after you enable caching. Use a list or search query to download package data without modifying your system.
Line 42: Line 36:
Enter the password for the ''root'' account when prompted.
Enter the password for the ''root'' account when prompted.


{| border="1"
{{Admon/note | Cache-only Mode Requires Cached Data | Cache-only mode requires package data to exist in the caches. If you enable caching, every <code>yum</code> operation may update the data files, unless cache-only mode is specified for the operation.}}
|-
| {{Template:Note}} '''Cache-only Mode Requires Cached Data'''
|-
| Cache-only mode requires package data to exist in the caches. If you enable caching, every <code>yum</code> operation may update the data files, unless cache-only mode is specified for the operation.
|}


{{Anchor|clearing_the_yum_caches}}
{{Anchor|clearing_the_yum_caches}}
Line 64: Line 53:
Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.
Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.


{| border="1"
{|
|-
|-
|[[Docs/Drafts/SoftwareManagementGuide/CustomizingYum| Previous Page - 9. Customizing yum]] ||[[Docs/Drafts/SoftwareManagementGuide| Table of Contents]] ||[[Docs/Drafts/SoftwareManagementGuide/YumProxy| Next Page - 11. Using yum with a Proxy Server]]
|[[Docs/Drafts/SoftwareManagementGuide/CustomizingYum| Previous Page - 9. Customizing yum]] ||[[Docs/Drafts/SoftwareManagementGuide| Table of Contents]] ||[[Docs/Drafts/SoftwareManagementGuide/YumProxy| Next Page - 11. Using yum with a Proxy Server]]
|}
[[Category:Software Management Guide]]

Latest revision as of 01:16, 4 March 2009

10. Working with yum Caching

By default, current versions of yum delete the data files and packages that they download, after these have been successfully used for an operation. This minimizes the amount of storage space that yum uses. You may enable caching, so that yum retains the files that it downloads in cache directories.

Caches provide three advantages:

  • The performance of yum increases
  • You may carry out yum operations without a network connection, by using only the caches
  • You may copy packages from the caches and reuse them elsewhere

By default, yum stores temporary files under the directory /var/cache/yum/, with one subdirectory for each configured repository. The packages/ directory within each repository directory holds the cached packages. For example, the directory /var/cache/yum/development/packages/ holds packages downloaded from the development repository.

Idea.png
Clearing the yum Caches
Cached files use disk space until removed. You may wish to periodically clear the yum caches to recover capacity. Refer to Section 10.3, “Clearing the yum Caches” for information on clearing the caches.

If you remove a package from the cache, you do not affect the copy of the software installed on your system.

10.1. Enabling the Caches

To configure yum to retain downloaded files rather than discarding them, set the keepcache option in /etc/yum.conf to 1:

keepcache=1

Refer to Section 9.1, “Editing the yum Configuration” for more information on editing the yum configuration file.

Once you enable caching, every yum operation may download package data from the configured repositories. To ensure that the caches have a set of package data, carry out an operation after you enable caching. Use a list or search query to download package data without modifying your system.

10.2. Using yum in Cache-only Mode

To carry out a yum command without a network connection, add the -C option. This causes yum to proceed without checking any network repositories, and use only cached files. In this mode, yum may only install packages that have been downloaded and cached by a previous operation.

To search for the package tsclient without using a network connection, enter the command:

su -c 'yum -C list tsclient'

Enter the password for the root account when prompted.

Note.png
Cache-only Mode Requires Cached Data
Cache-only mode requires package data to exist in the caches. If you enable caching, every yum operation may update the data files, unless cache-only mode is specified for the operation.

10.3. Clearing the yum Caches

If you configure it to do so, yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. To purge the package data files, use this command:

su -c 'yum clean headers'

Run this command to remove all of the packages held in the caches:

su -c 'yum clean packages'

When using these commands, at the prompt, enter the password for the root account.

Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.

Previous Page - 9. Customizing yum Table of Contents Next Page - 11. Using yum with a Proxy Server