Files
cheatsheets/ubnt-autopatch-set.md

1.1 KiB

sudo apt update

sudo apt install unattended-upgrades

sudo dpkg-reconfigure --priority=low unattended-upgrades

Edit the configuration file:

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

Uncomment or add (remove // from) the appropriate lines, like:

"${distro_id}:${distro_codename}-security";

"${distro_id}:${distro_codename}-updates";

Optional but recommended:

Enable automatic reboot after updates:

Unattended-Upgrade::Automatic-Reboot "true";

Set reboot time (optional):

Unattended-Upgrade::Automatic-Reboot-Time "02:00";

Edit the periodic config file:

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

Add or verify these lines:

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

APT::Periodic::Download-Upgradeable-Packages "1";

APT::Periodic::AutocleanInterval "7";

APT::Periodic::Unattended-Upgrade "1";

Explanation:

"1" means daily.

AutocleanInterval removes old package files weekly.

You can monitor updates with:

cat /var/log/unattended-upgrades/unattended-upgrades.log

Or errors:

cat /var/log/unattended-upgrades/unattended-upgrades.log