關於yum update和yum upgrade的區別


系統環境:CentOS Linux release 7.7.1908 (Core)

 

網上看到,很多說關於yum update和yum upgrade的區別是,

update會升級所有包同時也升級軟件和系統內核,而upgrade只升級所有包,不升級軟件和系統內核

其實這種說法是錯誤的!!!!!!!

 

首頁通過man yum命令看update解釋如下:

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 information) 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" com‐
       mand.

       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的解釋:

upgrade
       Is the same as the update command with the --obsoletes flag set. See update for more details.

這里可以看出,yum upgrade 其實就是和yum update --obsoletes的效果是一樣的,默認情況下/etc/yum.conf中就注明了obsoletes=1

總結:默認情況,都會升級內核、系統版本及every currently installed package,筆者測試甚至連安裝的httpd軟件包都是給升級了的!

那么自然也會清除舊的軟件版本,不過yum根據自己的計算或者推測決定是否obsoletes舊版本的,像內核之類的就會同時保留舊的版本!

不過最后筆者再次測試,將/etc/yum.conf中obsoletes的值改為0,yum update后,也暫時沒有發現什么不同,希望各位大佬能評論說出區別。

 

尊重別人的勞動成果 轉載請務必注明出處:https://www.cnblogs.com/5201351/p/13040260.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM