Description:

Install unattended-upgrades. The server should run unattended upgrades every night, and reboot at 4 am if required by any application.

Implementation:

  • Login as root
  • Install packages unattended-upgrades and cron-apt
  • Set the following values in /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Origins-Pattern {
        "o=Debian,a=stable";
};
Unattended-Upgrade::MinimalSteps "true";
Unattended-Upgrade::InstallOnShutdown "true";
Unattended-Upgrade::Mail "root";
Unattended-Upgrade::MailOnlyOnError "true";
Unattended-Upgrade::Remove-Unused-Dependencies "false";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:00";
Unattended-Upgrade::InstallOnShutdown "false";
  • Set the following values in /etc/apt/apt.conf.d/02periodic
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "30";

Verification:

  • Run unattended-upgrade --dry-run --debug as root. If there are any application upgrades available, they should show up.
  • Wait a few days and check /var/log/apt/history.log