LoginSignup
0
0

More than 1 year has passed since last update.

APT/DNFのパッケージ自動アップデート設定

Posted at

APT

https://www.mk-mode.com/blog/2019/10/14/debian-10-automation-security-update 参考

$ sudo apt install unattended-upgrades apt-listchanges
$ echo 'APT::Periodic::Update-Package-Lists "1";' | sudo tee -a /etc/apt/apt.conf.d/20auto-upgrades
$ echo 'APT::Periodic::Unattended-Upgrade "1";' | sudo tee -a /etc/apt/apt.conf.d/20auto-upgrades
$ sudo tee /etc/apt/apt.conf.d/02periodic <<EOF >/dev/null
// Control parameters for cron jobs by /etc/cron.daily/apt //

// Enable the update/upgrade script (0=disable)
APT::Periodic::Enable "1";

// Do "apt update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "1";

// Do "apt upgrade --download-only" every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages "1";

// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "1";

// Do "apt autoclean" every n-days (0=disable)
APT::Periodic::AutocleanInterval "21";

// Send report mail to root
//     0:  no report             (or null string)
//     1:  progress report       (actually any string)
//     2:  + command outputs     (remove -qq, remove 2>/dev/null, add -d)
//     3:  + trace on
APT::Periodic::Verbose "2";

EOF

$ sudo systemctl restart unattended-upgrades

DNF

https://ex1.m-yabe.com/archives/6276 参考

$ sudo dnf install dnf-automatic

sudo tee /etc/dnf/automatic.conf <<EOF >/dev/null
[commands]
upgrade_type = default
random_sleep = 0
network_online_timeout = 60
download_updates = yes
# 「no」から「yes」に変更
apply_updates = yes
[emitters]
# 「stdio」から「command_email」に変更します
emit_via = command_email 
[command_email] # dnf-automatic の結果をメール通知します設定
# コメントアウトを外す
command_format = "mail -Ssendwait -s {subject} -r {email_from} {email_to}"
# コメントアウトを外す
stdin_format = "{body}"
# 送信元のメールアドレスを設定
email_from = info@example.com
# 送信先のメールアドレスを設定
email_to = admin@example.jp
[base]
debuglevel = 1

EOF

$ sudo systemctl enable --now dnf-automatic.timer
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0