note: CentOS YUM 相關指令, update / upgrade

2018071921:36


「更新」所有已安裝的程式、套件:

$ yum update


只更新特定程式,套件:
$ yum update httpd
$ yum check-update




$ yum upgrade

 $ yum upgrade = yum --obsoletes update


man page 的說明

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" 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-ver‐
    sion 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.


 --obsoletes
    This  option  only has affect for an update, it enables yum´s obsoletes processing logic.
    For more information see the update command above.
    Configuration Option: obsoletes


 

#
upgrade 會清除舊版/過時的 package ,  update 不會
若某些程式有相依舊版 packeage 建議不要用 upgrade 命令

#
update  / upgrade 都會更新作業系統版本 (是指 子版本更新)
例如
目前是 CentOS 7.3
更新完 就變最新 CentOS 7.5





清除 /var/cache/yum 底下的暫存檔案:
 * 另 /etc/yum.conf

$ yum clean


*有可能清出 3+GB 的空間


相關
$ yum clean packages
$ yum clean headers



查詢套件資訊:

$ yum info [套件名稱]




列出已安裝的套件:

$ yum list installed

list 是一行行列出
像這樣:
:: :::
yum-metadata-parser.x86_64                           1.1.4-10.el7                            @anaconda
yum-plugin-fastestmirror.noarch                      1.1.31-45.el7                           @anaconda
yum-utils.noarch                                     1.1.31-45.el7                           @anaconda
zenity.x86_64                                        3.22.0-1.el7                            @anaconda
zip.x86_64                                           3.0-11.el7                              @anaconda
zlib.x86_64                                          1.2.7-17.el7                            @anaconda




改用 info 的話,會顯示套件詳細資料:

$ yum info installed

:: :::
Name        : nss-sysinit
Arch        : x86_64
Version     : 3.34.0
Release     : 4.el7
Size        : 14 k
Repo        : installed
From repo   : anaconda
Summary     : System NSS Initialization
URL         : http://www.mozilla.org/projects/security/pki/nss/
Licence     : MPLv2.0
Description : Default Operating System module that manages applications loading
            : NSS globally on the system. This module loads the system defined
            : PKCS #11 modules for NSS and chains with other NSS modules to load
            : any system or user configured modules.





列出可更新的套件:

yum list updates
yum info updates




搜尋

$ yum search [名稱/關鍵字]




ref:

https://access.redhat.com/documentation/zh-tw/red_hat_network_satellite/5.5/html/reference_guide/sect-reference_guide-package_updater-updating_packages_from_the_command_line_with_yum