利用dnf-automatic自动更新CentOS/RHEL/Rocky Linux系统和软件的简单教程。

1.首先安装dnf-automatic

dnf install dnf-automatic

2.自定义参数

nano /etc/dnf/automatic.conf

打开自动安装更新,将以下选项改为yes

apply_updates = yes

根据个人需要可以调整更新的内容和提示方式

//默认安装所有包和安全更新
upgrade_type = default
//只安装安全更新
upgrade_type = security
//直接在屏幕输出更新结果
emit_via = stdio
//每次登录的时候输出更新结果
emit_via = motd

3.检查和启动

//检查是否有语法错误
dnf-automatic
//启动服务 (每天6点会自动执行更新)
systemctl enable --now dnf-automatic.timer