auto upgrade - unattended-upgrades

最後更新: 2017-06-06

介紹

 

automatic installation of security upgrades

 


安裝

 

apt-get install unattended-upgrades

  • /usr/bin/unattended-upgrade
  • /usr/bin/unattended-upgrades

 

介面設定

dpkg-reconfigure unattended-upgrades  <--  此 cmd 會建立 "/etc/apt/apt.conf.d/20auto-upgrades"

 

設定

/etc/apt/apt.conf.d/20auto-upgrades

APT::Periodic::Update-Package-Lists "1";

# 二選一
# APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";

# apt job starts, it will sleep for a random period
APT::Periodic::RandomSleep "30";

APT::Periodic::AutocleanInterval "14";

/etc/apt/apt.conf.d/50unattended-upgrades

# 會自動 upgrade 什麼
Unattended-Upgrade::Allowed-Origins {
        "Ubuntu precise-security";
//      "Ubuntu precise-updates";
};

# 不自動 upgrade 的 package
Unattended-Upgrade::Package-Blacklist {
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";
};

// 'mailx' must be installed.
Unattended-Upgrade::Mail "root@localhost";
Unattended-Upgrade::MailOnlyOnError "false";

 


Service

 

# Enable

systemctl enable unattended-upgrades

/etc/init.d/unattended-upgrades start

# Disable

systemctl disable unattended-upgrades

/etc/init.d/unattended-upgrades stop

 


unattended-upgrade

 

  • --dry-run
  • -d, --debug

i.e.

unattended-upgrade -d --dry-run

Log:

/var/log/unattended-upgrades

 


Notifications

 

apticron - Simple tool to mail about pending package updates

apt-get install apticron

 


 

 

 

 

Creative Commons license icon Creative Commons license icon