How to Setup and Enable Automatic Security Updates on Ubuntu/Debian
Introduction
You risk overall security if you fail to keep your Ubuntu/Debian operating system packages up-to-date. Malicious actors can exploit security flaws in outdated packages. Keeping your packages up-to-date helps to protect you from these attacks. Additionally, updates often include bug fixes and other minor improvements that can help keep your system running smoothly. Fortunately, there is an alternative - automatic updates.
With automated updates enabled, your system will be updated with the latest security patches and bug fixes as soon as they're released. This will keep your system secure and running smoothly, without having to manually check for updates. This tutorial explains how to enable automatic security updates in Ubuntu and Debian.
Step-to-step guide to make automatic updates for Ubuntu/Debian
Step 1. You can install the upgrade by running the following command.
sudo apt update && sudo apt upgrade
Step 2. To 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
Conclusion
Follow this guide to install, configure, and enable automatic security updates on Ubuntu/Debian. This guide will fully automate the entire process of protecting your system from the latest security threats. With automatic security updates, you can have peace of mind knowing that your system is constantly updated with the latest security patches, reducing the risk of vulnerabilities and potential attacks. Maintaining the integrity of your system is made easier by implementing automatic security updates.