CentOS8 の dnf でセキュリティに関するパッケージの更新のみ行う
CentOS8 の dnf コマンドにはセキュリティに関するパッケージのみ対象とする --security オプションがありますが、CentOS ではセキュリティアップデート用のリポジトリが公開されていない為、デフォルトでは機能しません。
そこで、--security を機能させる為の設定について説明します。
セキュリティアップデート用のリポジトリを、ローカルに作成するスクリプトが公開されているので、それを使用します。
以下を実行します。
dnf install createrepo
mkdir /security
wget -P/security https://raw.github.com/hany55/generate_updateinfo/master/generate_updateinfo.py
sed -i -e "s/BUILD_PREFIX = options\.destination/BUILD_PREFIX = \"\/security\"/g" /security/generate_updateinfo.py
createrepo /security
/etc/yum.repos.d/CentOS-Base.repo の末尾に次を追加します。
[security]
name=CentOS-$releasever - Security
baseurl=file:///security
これでインストール・設定は完了です。
まず、下記を実行します。
wget -q -N -P/security http://cefs.steve-meier.de/errata.latest.xml
python3 /security/generate_updateinfo.py /security/errata.latest.xml
/usr/bin/modifyrepo /security/updateinfo-8/updateinfo.xml /security/repodata
一日に一度実行すれば充分なので、必要に応じて cron で実行するように設定して下さい。
これで、dnf で --security オプションが機能するようになります。
セキュリティ更新があるかのチェックは dnf --security check-update を実行します。
チェックだけではなく、セキュリティ更新も適用する場合は dnf --security upgrade を実行します。
そこで、--security を機能させる為の設定について説明します。
セキュリティアップデート用のリポジトリを、ローカルに作成するスクリプトが公開されているので、それを使用します。
インストール・設定
以下を実行します。
dnf install createrepo
mkdir /security
wget -P/security https://raw.github.com/hany55/generate_updateinfo/master/generate_updateinfo.py
sed -i -e "s/BUILD_PREFIX = options\.destination/BUILD_PREFIX = \"\/security\"/g" /security/generate_updateinfo.py
createrepo /security
/etc/yum.repos.d/CentOS-Base.repo の末尾に次を追加します。
[security]
name=CentOS-$releasever - Security
baseurl=file:///security
これでインストール・設定は完了です。
セキュリティアップデートの仕方
まず、下記を実行します。
wget -q -N -P/security http://cefs.steve-meier.de/errata.latest.xml
python3 /security/generate_updateinfo.py /security/errata.latest.xml
/usr/bin/modifyrepo /security/updateinfo-8/updateinfo.xml /security/repodata
一日に一度実行すれば充分なので、必要に応じて cron で実行するように設定して下さい。
これで、dnf で --security オプションが機能するようになります。
セキュリティ更新があるかのチェックは dnf --security check-update を実行します。
チェックだけではなく、セキュリティ更新も適用する場合は dnf --security upgrade を実行します。
この記事へのコメント