What is yum equivalent of 'apt-get update'?

The check-update command will refresh the package index and check for available updates:

yum check-update

While yum check-update will check updates for installed packages, if it needs to be refreshed, so will most other commands.

The command that's strictly the equivalent of apt-get update is yum makecache ... however it's generally not recommended to run that directly, in yum.


Unfortunately yum check-update by default doesn't pull down changes from remote repositories until yum.conf's metadata_expire parameter has elapsed (default 90m). Apparently its purpose is "know if your machine had any updates that needed to be applied without running it interactively" so basically it's "check if any packages are update-able" not "refresh the list of packages that I could update to" as you'd expect.

So if you run yum check-update and get this:

$ sudo yum check-update
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

packagename      version     repo

This means that check-update is not performing an update, like apt-get update does.

You can see how long it will take before doing the "auto refresh" that all commands do underneath, by running this: yum repolist enabled -v

Work around:

use yum clean expire-cache (or yum clean all) first, then any future yum commands will auto-refresh the cache "when run." . Because future yum commands refresh the cache, this is in practice the same as apt-get update.

Or change the metadata_expire parameter of yum.conf to less than the default 90min, I guess.

Or run yum makecache (from the other answers) which seems to remove the cache and pull down fresh copies right then. But it seems to take longer than clean all (?) FWIW.