检查并更新

dnf可以检查您的系统中是否有软件包需要更新。您可以通过dnf列出需要更新的软件包,并可以选择一次性全部更新或者只对指定包进行更新。

检查更新

如果您需要显示当前系统可用的更新,使用命令如下:

  1. dnf check-update

使用实例如下:

  1. # dnf check-update
  2. Last metadata expiration check: 0:02:10 ago on Sun 01 Sep 2019 11:28:07 PM CST.
  3. anaconda-core.aarch64 19.31.123-1.14 updates
  4. anaconda-gui.aarch64 19.31.123-1.14 updates
  5. anaconda-tui.aarch64 19.31.123-1.14 updates
  6. anaconda-user-help.aarch64 19.31.123-1.14 updates
  7. anaconda-widgets.aarch64 19.31.123-1.14 updates
  8. bind-libs.aarch64 32:9.9.4-29.3 updates
  9. bind-libs-lite.aarch64 32:9.9.4-29.3 updates
  10. bind-license.noarch 32:9.9.4-29.3 updates
  11. bind-utils.aarch64 32:9.9.4-29.3 updates
  12. ...

升级

如果您需要升级单个软件包,在root权限下执行如下命令:

  1. dnf update package_name

例如升级rpm包,示例如下:

  1. # dnf update anaconda-gui.aarch64
  2. Last metadata expiration check: 0:02:10 ago on Sun 01 Sep 2019 11:30:27 PM CST.
  3. Dependencies Resolved
  4. ================================================================================
  5. Package Arch Version Repository Size
  6. ================================================================================
  7. Updating:
  8. anaconda-gui aarch64 19.31.123-1.14 updates 461 k
  9. anaconda-core aarch64 19.31.123-1.14 updates 1.4 M
  10. anaconda-tui aarch64 19.31.123-1.14 updates 274 k
  11. anaconda-user-help aarch64 19.31.123-1.14 updates 315 k
  12. anaconda-widgets aarch64 19.31.123-1.14 updates 748 k
  13. Transaction Summary
  14. ================================================================================
  15. Upgrade 5 Package
  16. Total download size: 3.1 M
  17. Is this ok [y/N]:

类似的,如果您需要升级软件包组,在root权限下执行如下命令:

  1. dnf group update group_name

更新所有的包和它们的依赖

要更新所有的包和它们的依赖,在root权限下执行如下命令:

  1. dnf update