Automatic updates for Ubuntu/Debian

Step-to-step guide to make automatic updates for Ubuntu/Debian

Step 1. Update the server by running:

sudo apt update && sudo apt upgrade

Step 2. Install automatic updates. Enter the following command:

sudo apt install unattended-upgrades apt-listchanges bsd-mailx

Step 3. Enable automatic security updates by running:

sudo dpkg-reconfigure -plow unattended-upgrades

Step 4. Set up automatic updates:

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

Step 5. Uncomment and correct the lines.
Email Alert ID :

Unattended-Upgrade::Mail "mail@domain.com";

Step 6. Email alerts only if the update fails:

Unattended-Upgrade::MailOnlyOnError "true";

Step 7. Automatically reboot without confirming kernel updates, uncomment the line:

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

Step 8.  Set the email ID:

sudo nano /etc/apt/listchanges.conf

Step 9. Save and close the file.

Step 10. Make sure it works by running the following command:

sudo unattended-upgrades --dry-run