说明
CentOS8中,yum
命令和dnf
命令相同, 而 dnf update
命令是 dnf upgrade
的别名,所以两者是一样的;建议直接使用dnf upgrade
见如下
shell
$ man yum
结果
text
YUM(8) DNF YUM(8)
NAME
yum - redirecting to DNF Command Reference
SYNOPSIS
dnf [options] <command> [<args>...]
省略...
查看update命令
shell
$ dnf update -h
结果是
text
usage: dnf upgrade [-c [config file]] [-q] [-v] [--version]
省略...
补充
升级软件包的时候,如果不需要升级的内核,可以添加 exclude 参数过滤,例如centos的升级
shell
$ dnf --exclude=kernel* --exclude=centos-release* -y upgrade
或者直接修改配置文件 /etc/yum.conf
, 在[main]配置添加配置项
text
exclude=kernel*
exclude=centos-release*
之后重新执行
shell
$ dnf upgrade -y