Unix & Linux: What is yum equivalent of 'apt-get update'? (4 Solutions!!)

Описание к видео Unix & Linux: What is yum equivalent of 'apt-get update'? (4 Solutions!!)

Unix & Linux: What is yum equivalent of 'apt-get update'?


The Question: Debian's apt-get update fetches and updates the package index. Because I'm used
to this way of doing things, I was surprised to find that yum update does all
that and upgrades the system. This made me curious of how to update the package
index without installing anything.

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

== This solution helped 99 people ==
The check-update command will refresh the package index and check for available
updates:
yum check-update

== This solution helped 32 people ==
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.

== This solution helped 24 people ==
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 https://unix.stackexchange.com/a/350321/
8337: yum repolist enabled -v
Work around:
https://superuser.com/a/341228/39364 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.

With thanks & praise to God, and with thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free... | Images: https://stocksnap.io/license & others | With thanks to user wag (https://unix.stackexchange.com/users/..., user Tufan K (https://unix.stackexchange.com/users/..., user tshepang (https://unix.stackexchange.com/users/..., user SuB (https://unix.stackexchange.com/users/..., user rogerdpack (https://unix.stackexchange.com/users/..., user James Antill (https://unix.stackexchange.com/users/..., and the Stack Exchange Network (http://unix.stackexchange.com/questio.... Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything is amiss at Roel D.OT VandePaar A.T gmail.com.

Комментарии

Информация по комментариям в разработке