長いので結論だけ先に書くと
CentOSで
yum update
時に”Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast”というメッセージが出ることがあるyum claen all
しろというサイトもあるが、エラーメッセージの通り、素直にyum makecache fast
しましょう
本論
案件が変わってちょっと自宅で自習したくなり、昔に作ったCentOSのVMをアップデートしようとしたら以下のメッセージが出た
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
ググってみるとyumのキャッシュの問題らしく、キャッシュをyum claen all
してクリアすればよいらしい。
で、実際にyum claen all
してからyum update
すると無事にアップデートはできた。
が、しかし、メッセージをよく読むとyum makecache fast
しろって書いてある*2。
そこでちょっとmanを読んでみる(長いので読み飛ばしてもOK)。
yum(8) yum(8) NAME yum - Yellowdog Updater Modified (中略) clean Is used to clean up various things which accumulate in the yum cache directory over time. More complete details can be found in the Clean Options section below. makecache Is used to download and make usable all the metadata for the currently enabled yum repos. If the argument "fast" is passed, then we just try to make sure the repos. are current (much like "yum clean expire-cache"). (中略) 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. yum clean expire-cache Eliminate the local data saying when the metadata and mir‐ rorlists were downloaded for each repo. This means yum will revalidate the cache for each repo. next time it is used. How‐ ever if the cache is still valid, nothing significant was deleted. yum clean packages Eliminate any cached packages from the system. Note that pack‐ ages are not automatically deleted after they are downloaded. yum clean headers Eliminate all of the header files, which old versions of yum used for dependency resolution. yum clean metadata Eliminate all of the files which yum uses to determine the remote availability of packages. Using this option will force yum to download all the metadata the next time it is run. yum clean dbcache Eliminate the sqlite cache used for faster access to metadata. Using this option will force yum to download the sqlite metadata the next time it is run, or recreate the sqlite metadata if using an older repo. yum clean rpmdb Eliminate any cached data from the local rpmdb. yum clean plugins Tell any enabled plugins to eliminate their cached data. yum clean all Does all of the above.
とても雑にまとめると以下の表のとおり。
yum clean all
は余計なキャッシュデータも消してしまっているので、yum makecache fast
を使ってキャッシュを更新する方が好ましいのだと思う。
# | コマンド | 説明 |
---|---|---|
1 | yum clean all |
現在利用可能なレポジトリの すべてのキャッシュを削除する*3 |
2 | yum makecache fast |
現在利用可能なレポジトリを確認して キャッシュの一部を更新する*4 |
その他
manを読んでyumの正式名称を初めて知った Yellowdog Updater Modified - Wikipedia