CentOS 8 で DNF の自動アップデートを設定する
篠原 隆司
さくらのVPSにCentOS 8をインストールした覚書です。
今回は、サーバのアップデートを自動的に行う dnf-automatic の設定を行っていきたいと思います。
CentOS7 までは yum-cron を使っていたと思います。
CentOS8 からは、yum が dnf になり、yum-cron ではなく dnf-automatic を使っていきます。
なお本番環境で利用される場合はここにある内容だけを鵜呑みにせずセキュリティ専門家に相談されることをお勧めします。
環境
実施日 | 2020-05-29 |
サーバ | さくらのVPS 2G![]() |
OS | CentOS 8.1 |
cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)
dnf-automaticのインストール
dnfからインストールします。
dnf install dnf-automatic
設定の変更
vi /etc/dnf/automatic.conf
# アップデートの種類
# default すべてのパッケージ
# security セキュリティ関係のみ
upgrade_type = default
# アップデート適用のタイミング
# yes 即時、自動更新したいならこちら
# no ダウンロードのみ
apply_updates = yes
コマンド集
# 自動起動に登録
systemctl enable dnf-automatic.timer
# 開始
systemctl start dnf-automatic.timer