CentOSでyum update時に”Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast”というメッセージが出たときは素直に「yum makecache fast」しましょう


  1. CentOSyum update時に”Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast”というメッセージが出ることがある

  2. これはyumのキャッシュデータ*1が古くなって失敗している。

  3. yum claen allしろというサイトもあるが、エラーメッセージの通り、素直にyum makecache fastしましょう



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)

       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.

              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").


       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

       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 現在利用可能なレポジトリの
2 yum makecache fast 現在利用可能なレポジトリを確認して


manを読んでyumの正式名称を初めて知った Yellowdog Updater Modified - Wikipedia

*1:デフォルトは/var/cache/yum/$basearch/$releasever /。/etc/yum.confのcachedirで設定する



*4:yum clean expire-cache相当ということはメタデータとミラーリスト?