Linux var cache yum

/var/cache/yum Constantly Filling Files System in CentOS/RHEL

This post explains how to free up space when files under /var/cache/yum is filling up the disk space. This is normal behavior as the cache would increase its size based on the frequency of syncing with the yum server. Its an administrative task provide adequate space.

This should be corrected by either running:

The above command cleans all cached files from any enabled repository. It is useful to run this from time to time to make sure there is nothing using unnecessary space.

This cleans up any xml metadata that may have been cached from any enabled repository.

Possible permanent solutions

Option 1

Increase the space of the file system.

Option 2

This would be normal behavior of yum as it does this to speed the process of updating/installing files. If you would like to prevent the FS from filling up you can disable the “yum-updatesd” service as well as, “rhnsd” if enabled, and then re-enabling it when needed.

It can also be accomplished this by running the following commands:

# service yum-updatesd stop # chkconfig yum-updatesd off
# service rhnsd stop # chkconfig rhnsd off

Option 3

By default yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. This feature can be turned off by modifying the /etc/yum.conf file and changing the option “keepcache” to 0.

keepcache when set to 0, removes packages after installation. Setting keepcache=1 instructs yum to keep the cache of headers and packages after a successful installation.

Option 4

Another possible solution would be to remove the ‘/var/cache/yum‘ directory or clean up the sub-directories, better if you take a backup in case it is needed later. After removing it, perform a ‘yum check-update‘ and the directory structures will be recreated.

Читайте также:  Linux утилиты для компьютера

Final Thoughts

If none of the above options fix the issue with /var/cache/yum, it might be something related to the specific packages or kernel present in your system. Also, the issue can be related to the repositories or channels registered on your server.

Источник

How to Clean YUM Cache

YUM (Yellowdog Updater, Modified) is a package manager for RPM-based distributions. While YUM is a powerful tool for managing packages and dependencies, the utility sometimes caches a lot of data, taking up disk space.

This tutorial explains how to clean YUM cache and keep the system running smoothly.

How to Clean YUM Cache

  • A Linux system with YUM installed (this tutorial uses CentOS 7).
  • Access to the terminal.
  • Sudo permissions.

How to Clear YUM Cache?

When a user installs a package, YUM downloads and stores it in /var/cache/yum. However, packages remain in cache even after they’ve been installed and removed. In time, the stored cache may take up too much disk space or cause issues due to corrupt metadata.

To reclaim disk space, use the following methods to clear the YUM cache.

1. Clean Cached YUM Packages

Run the following command to purge all cached packages from the enabled repositories cache directory:

sudo yum clean packages terminal output

The command lists the repos it goes through and deletes cached packages..

2. Clean Package Headers

When YUM updates the local cache, it downloads the package headers and stores them as xml metadata in /var/cache/yum.

To delete cached package headers, run:

sudo yum clean headers terminal output

3. Delete Metadata for Each Enabled Repository

YUM uses metadata, such as the package name, version, and dependencies, to manage and update packages.

Clean cached metadata from each enabled repository with:

sudo yum clean metadata terminal output

4. Clean All Cached Files

Remove all cached files from all enabled repositories at once with:

sudo yum clean all terminal output

The «Metadata File Does not Match Checksum» Error

Deleting YUM cache can help resolve issues with corrupt metadata. However, if you receive the «Metadata file does not match checksum» error, cleaning the YUM cache might not help resolve it. As an alternative solution, disable YUM package caching.

1. Open the /etc/yum.conf file using a text editor.

2. Find and edit http_caching=packages to http_caching=none .

Complete the YUM operation that invoked the error and revert the settings in the YUM configuration file once complete.

After reading this tutorial, you know how to clean the YUM cache with the clean command. Next, learn how to create local YUM repositories in CentOS.

Источник

Yum, шпаргалка

Шпаргалка по работе с пакетным менеджером Yum (Yellowdog Updater, Modified), который используется в популярных Linux дистрибутивах: RedHat, CentOS, Scientific Linux (и других). В целях экономии места вывод команд не представлен.

Оглавление

#yum updateinfo list security
#yum groupinfo "Basic Web Server"
#yum groupinstall "Basic Web Server"
#yum groupremove "Basic Web Server"
#yum repo-pkgs reponame install
#yum repo-pkgs reponame remove

проверить локальную базу rpm (поддерживаются параметры dependencies, duplicates, obsoletes, provides)

Читайте также:  Linux find kernel file

установить из локальной директории (поиск/установка зависимостей будут произведены из подключенных репозиториев)

#yum localinstall httpd.rpm
#yum localinstall http://server/repo/httpd.rpm

Опции Yum

--disableplugin=fastestmirror
#yum update -y --enablerepo=epel
#yum update -y --disablerepo=epel

скачать пакеты, но не устанавливать
(на Centos 7 x86_64 будут скачаны в ‘/var/cache/yum/x86_64/7/base/packages/’)

#yum install httpd --downloadonly

Cледующие команды доступны после установки пакета yum-utils

#repoquery --requires --resolve httpd
#reposync -p repo1 --repoid=updates

запрос к локальной базе yum, отображение информации о пакете
(использованная команда, контрольная сумма, URL с которого был установлен и другое)

скачать src.rpm пакет из репозитория
(должен быть подключен соответствующий репозиторий, например в ‘/etc/yum.repos.d/CentOS-Sources.repo’ в CentOS)

Конфигурационные файлы Yum и их расположение

Некоторые опции yum.conf:

cachedir=/var/cache/yum/$basearch/$releasever

Определяет должен или нет Yum хранить кэш заголовков и пакетов после успешной установки. Значения: 0 или 1. (по умолчанию 1)

Некоторые полезные плагины

Работа Yum через прокси сервер

proxy_proxy_username=user proxy_password=pass
#export http_proxy="http://server:3128"

Источник

How to clean YUM cache in CentOS / RHEL

For some operations (for example, a yum install operation), Yum downloads the packages to install into the Yum cache. The cached packages are located in a subdirectory structure from /var/cache/yum that reflects the architecture, the distribution release, and the repository from where the packages were downloaded.

After successful installation, the packages are deleted from the cache. To retain the cached packages, change the keepcache setting to 1 in the /etc/yum.conf file as follows:

# vi /etc/yum.conf keepcache = 1

Cleaning the Yum Cache

Clean the Yum cache to reclaim disk space or to clear errors due to corrupted metadata files. To remove cached packages only, use:

To delete metadata for each enabled repository, use the following command:

To delete package headers, use the following command:

To clean all cached information, use the following command:

If you get the message “Metadata file does not match checksum” during a Yum operation, clearing the metadata from the cache might not help. In this case, adding the following line to /etc/yum.conf resolves the problem:

# vi /etc/yum.conf http_caching=none

Changing default location of yum cache

Sometimes when the default yum cache location is full, you would get an error while installing any yum package.

insufficient space in download directory /var/cache/yum/rhel-x86_64-server-6/packages

As the /var filesystem where yum cache is located is full and there is no disk space for yum to download the system updates, the above error will be shown.

The yum cache location is configured in /etc/yum.conf file as cachedir option in the [main] section and can be changed:

$ cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever

Источник

Читайте также:  How to recover linux mint

🤾♂️ «Yum clean all» не очищает кэш репозитория yum в CentOS / RHEL / OEL

«Yum clean all» не очищает информацию о кэше yum в /var/cache/yum сервера Orcle Linux, который использует общедоступный репозиторий Oracle или локальный репозиторий yum.

# yum repolist Loaded plugins: refresh-packagekit, security, ulninfo public_ol6_UEK_latest | 1.2 kB 00:00 public_ol6_UEK_latest/primary | 26 MB 00:04 public_ol6_UEK_latest 554/554 public_ol6_latest | 1.4 kB 00:00 public_ol6_latest/primary | 58 MB 00:04 public_ol6_latest 36051/36051 repo id repo name status public_ol6_UEK_latest Latest Unbreakable Enterprise Kernel for Oracle Linux 6Ser 554 public_ol6_latest Oracle Linux 6Server Latest (x86_64) 36,051 repolist: 36,605
# du -sh /var/cache/yum/x86_64/6Server/* 864K /var/cache/yum/x86_64/6Server/ol6_addons 973M /var/cache/yum/x86_64/6Server/ol6_latest 367M /var/cache/yum/x86_64/6Server/ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_latest 8.0K /var/cache/yum/x86_64/6Server/public_ol6_UEK_latest 45MB /var/cache/yum/x86_64/6Server/public_ol6_UEKR3_latest
# yum clean all Loaded plugins: refresh-packagekit, security, ulninfo Cleaning repos: public_ol6_UEK_latest public_ol6_latest Cleaning up Everything
# du -sh /var/cache/yum/x86_64/6Server/* 864K /var/cache/yum/x86_64/6Server/ol6_addons 973M /var/cache/yum/x86_64/6Server/ol6_latest 367M /var/cache/yum/x86_64/6Server/ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_latest 8.0K /var/cache/yum/x86_64/6Server/public_ol6_UEK_latest 45MB /var/cache/yum/x86_64/6Server/public_ol6_UEKR3_latest

Решение

«Yum clean» удаляет кеш репозиториев, которые включены в /etc/yum.repos.d/*.repo. Из справочной страницы yum:

# man yum . CLEAN OPTIONS The following are the ways which you can invoke yum in clean mode. Note that "all files" in the commands below means "all files in currently enabled repositories". If you want to also clean any (temporarily) disabled repositories you need to use --enablerepo=’*’ option.

Для устранения неполадок выполните следующие действия:

1. Временно включите репозитории, чтобы очистить кэш yum.

# yum clean all --enablerepo="repository_label"
# vi /etc/yum.repos.d/[filename].repo . enabled = 1 ### Add this for the respective repository.

Что делать, если в файле /etc/yum.repos.d/*.repo нет информации о репозитории?

В этом случае временная запись в файле репозитория с именем метки репозитория поможет очистить кэш.

Отладка

В следующем примере включены только два репозитория, т. е. «Public_ol6_UEK_latest, public_ol6_latest», тогда как информация кэша yum доступна для нескольких дополнительных репозиториев.

Предположим, что репозиторий «public_ol6_UEKR3_latest» отключен, а у «ol6_UEK_latest, ol6_latest» нет записи в файле /etc/yum.repos.d/*.repo.

# yum repolist Loaded plugins: refresh-packagekit, security, ulninfo public_ol6_UEK_latest | 1.2 kB 00:00 public_ol6_UEK_latest/primary | 26 MB 00:04 public_ol6_UEK_latest 554/554 public_ol6_latest | 1.4 kB 00:00 public_ol6_latest/primary | 58 MB 00:04 public_ol6_latest 36051/36051 repo id repo name status public_ol6_UEK_latest Latest Unbreakable Enterprise Kernel for Oracle Linux 6Ser 554 public_ol6_latest Oracle Linux 6Server Latest (x86_64) 36,051 repolist: 36,
# du -sh /var/cache/yum/x86_64/6Server/* 864K /var/cache/yum/x86_64/6Server/ol6_addons 973M /var/cache/yum/x86_64/6Server/ol6_latest 367M /var/cache/yum/x86_64/6Server/ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_latest 8.0K /var/cache/yum/x86_64/6Server/public_ol6_UEK_latest 45MB /var/cache/yum/x86_64/6Server/public_ol6_UEKR3_latest

Очистите информацию кеша отключенного репозитория, который имеет запись в файле /etc/yum.repos.d/*.repo. то есть public_ol6_UEKR3_latest:

# yum clean all --enablerepo="public_ol6_UEKR3_latest"
# du -sh /var/cache/yum/x86_64/6Server/* 864K /var/cache/yum/x86_64/6Server/ol6_addons 973M /var/cache/yum/x86_64/6Server/ol6_latest 367M /var/cache/yum/x86_64/6Server/ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_latest 8.0K /var/cache/yum/x86_64/6Server/public_ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_UEKR3_latest

Чтобы очистить кэш двух других репозиториев, у которых нет записи в «/etc/yum.repos.d/*.repo», его можно удалить вручную или добавить временную запись в конфигурационном файле.

# rm -rf /var/cache/yum/x86_64/6Server/ol6_latest /var/cache/yum/x86_64/6Server/ol6_latest
# vi /etc/yum.repos.d/public.repo [ol6_latest] enabled = 1 [ol6_UEK_latest] enabled = 1
# du -sh /var/cache/yum/x86_64/6Server/* 864K /var/cache/yum/x86_64/6Server/ol6_addons 12.0K /var/cache/yum/x86_64/6Server/ol6_latest 8.0K /var/cache/yum/x86_64/6Server/ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_latest 8.0K /var/cache/yum/x86_64/6Server/public_ol6_UEK_latest 12K /var/cache/yum/x86_64/6Server/public_ol6_UEKR3_latest

Источник

Оцените статью
Adblock
detector