Security updates are essential to protect your server against known vulnerabilities. With unattended-upgrades, critical patches are installed automatically.
1. Installation (Debian/Ubuntu):sudo apt install unattended-upgrades apt-listchanges
2. Enable it:sudo dpkg-reconfigure -plow unattended-upgrades
Select "Yes".
3. Adjust the configuration:sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Make sure security updates are enabled:"${distro_id}:${distro_codename}-security";
4. Optional – email notifications:
Add the following to the configuration:Unattended-Upgrade::Mail "[email protected]";
For the emails to actually arrive, the server needs a working mail setup, e.g. sudo apt install bsd-mailx plus a configured mail transfer agent (MTA) such as Postfix or Exim.
Check the status:sudo unattended-upgrades --dry-run
Tip: Regularly check the logs in /var/log/unattended-upgrades/ to make sure everything is running correctly.