CentOS 中 yum update 與 yum upgrade 的區別
阿新 • • 發佈:2018-12-20
在 CentOS 系統中,yum upgrade
與 yum update
都會將系統包更新到最新版本。
至於區別,我們還是通過 man yum
的幫助資訊來了解也許更好:
update If run without any packages, update will update every currently installed package. If one or more packages or package globs are specified, Yum will only update the listed packages. While updating packages, yum will ensure that all dependencies are satisfied. (See Specifying package names for more infor‐ mation) If the packages or globs specified match to packages which are not currently installed then update will not install them. update operates on groups, files, provides and filelists just like the "install" command. If the main obsoletes configure option is true (default) or the --obsoletes flag is present yum will include package obsoletes in its calculations - this makes it better for distro-version changes, for example: upgrading from somelinux 8.0 to somelinux 9. Note that "update" works on installed packages first, and only if there are no matches does it look for available packages. The difference is most noticeable when you do "update foo-1-2" which will act exactly as "update foo" if foo-1-2 is installed. You can use the "update-to" if you'd prefer that nothing happen in the above case. upgrade Is the same as the update command with the --obsoletes flag set. See update for more details.
根據幫助資訊可以看到,upgrade
與附帶 --obsoletes
的選項時的 update
是一樣的,
重要說明如下:
upgrade:
Is the same as the update command with the
--obsoletes
flag set. See update for more details.update:
If the main obsoletes configure option is
true (default)
or the --obsoletes flag is present yum will include package obsoletes in its calculations- this makes it better for distro-version changes, for example: upgrading from somelinux 8.0 to somelinux 9.
然而, update
即使不附帶 --obsoletes
選項時,預設的配置中將其設定為了 true
(開啟),在 /etc/yum.conf
檔案中可以檢視到預設的配置資訊:
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release
所以,只能說預設情況下沒有區別,而使用 update
則更為靈活。
參考:
in-centos-what-is-the-difference-between-yum-update-and-yum-upgrade
CONFIGURING YUM AND YUM REPOSITORIES
轉載至https://www.jianshu.com/p/4df7692bdc2b