Enable Apt Unattended Upgrades with Email Notifications
Apt can perform unattended upgrades if a system has no new software configurations. This is highly suitable for production system that is meant for long run. This section guides you on how to setup unattended upgrades for apt with email notification.
Enable Unattended Upgrades
To enable unattended upgrades, you just need to install the package and most of the configurations should be done automatically.
$ apt install unattended-upgrades apt-listchanges -y
Once done, you need to enable the apt source list inside /etc/apt/apt.conf.d/50unattended-upgrades
under the following header:
Unattended-Upgrade::Origins-Pattern {
...
}
Activate
To activate unattended-upgrades, you need to ensure /etc/apt/apt.conf.d/20auto-upgrades
:
APT::Periodic::Enable "1";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Verbose "3";
Once done, you can run it manually to check its functionality is working fine by running the following command as root:
$ unattended-upgrade -d
ListChanges
The next thing is to ensure /etc/apt/listchanges.conf
has the following:
[apt]
frontend=pager
which=both
email_address=root
email_format=text
confirm=false
headers=false
reverse=false
save_seen=/var/lib/apt/listchanges.db
Enable Email Notification
To enable notification when unattended upgrades is executed, you need to modify /etc/apt/apt.conf.d/50unattended-upgrades
and un-comment the following:
Unattended-Upgrade::Mail "root";
That's all for enabling unattended-upgrades.