To keep a Debian Linux system patched with the latest security updates automatically, you can use the unattended-upgrades package. This package allows you to configure automatic installation of security updates on your system.
To install unattended-upgrades on Debian, follow these steps:
sudo apt-get update
unattended-upgrades package by running the following command:sudo apt-get install unattended-upgrades
This will install the unattended-upgrades package and any dependencies required.
/etc/apt/apt.conf.d/50unattended-upgrades file in a text editor and uncomment the following line:Unattended-Upgrade::Automatic-Reboot "true";
This will enable automatic reboots when required by an upgrade.
/etc/apt/apt.conf.d/20auto-upgrades file in a text editor and uncomment the following line:APT::Periodic::Unattended-Upgrade "1";
This will enable automatic upgrading of all packages, including security updates.
/etc/apt/apt.conf.d/20auto-upgrades file in a text editor and uncomment the following lines:Unattended-Upgrade::Origins-Pattern {
"o=Debian,a=stable";
"o=Debian,a=stable-updates";
};
This will enable automatic upgrades from the stable and stable-updates repositories.
/etc/apt/apt.conf.d/50unattended-upgrades file in a text editor and uncomment the following lines:Unattended-Upgrade::Automatic-Reboot "true"; Unattended-Upgrade::Automatic-Reboot-Time "01:00";
This will enable automatic reboots when required by an upgrade and set the reboot time to 1:00 AM.
That's it! unattended-upgrades is now configured to automatically install security updates on your Debian Linux system. The system will check for updates daily and install them automatically if they are available. If a reboot is required, it will be scheduled for 1:00 AM.