yum-cron による自動アップデート

例のglibcの祭りの際、Critical なものは自動でアップデートしても良くね?という話がさらりと出てきたので一応メモ

注意

CentOS の場合

"yum-security-plugin" はCentOSでは動かない模様・・・残念。。

https://www.centos.org/forums/viewtopic.php?f=13&t=54597

The yum-plugin-security package does not work on CentOS and there have been several long and involved threads on the mailing list discussing this and the outcome is that it probably never will. The required metadata is not present in the CentOS yum repositories to allow it to function. EPEL does supply this data which is why you see some mentions of security updates available but it does not cover any of the packages in the CentOS repos.

Amazon Linux の場合

リスクレベルの指定(--sec-severity)は動作しなかったけど、"--security" でセキュリティに限定したパッケージアップデートは可能なようだった。

yum-cron と security plugin のインスコ

ヤッムヤッム!!( ゚∀゚)o彡°

# yum install yum-cron yum-plugin-security

※RHEL7系の場合 "yum-plugin-security" はなくなり統合されてる?模様

設定

さっくり書き換えるだけ。

RHEL/CentOS7の場合

# cd /etc/yum/
# cp yum-cron.conf{,.orig}
# vi yum-cron.conf

変更点だけ列挙

## リスクレベル Critical のものだけ適用、 ★CentOSの場合は "default" のままにする。
update_cmd = minimal-security-severity:Critical

## 自動的に適用
apply_updates = yes

## システム名
system_name = Underboob

## メール送信元/宛先アドレス
email_from = root@localhost
email_to = root

RHEL6/CentOS6の場合

# cd /etc/sysconfig
# cp yum-cron{,.orig}
# vi yum-cron

変更点だけ列挙

## リスクレベル Critical のものだけ適用、CentOSの場合は "update" にする。
YUM_PARAMETER="--sec-severity=Critical update-minimal"

## メール送信先
MAILTO=root

## システム名
SYSTEMNAME="Underboob"

サービスの有効化と起動

RHEL/CentOS7系の場合

# systemctl enable yum-cron
# systemctl start yum-cron

RHEL/CentOS6系の場合

# chkconfig yum-cron on
# servie yum-cron start

以上