Kyrnet opens soon. Get notified of the launch on our Discord.

Join our Discord →
KyrnetKyrnet
Security

Turning on automatic security updates

Install security fixes automatically on Debian, Ubuntu, AlmaLinux and Rocky Linux, and choose when reboots happen.

1 min read · Updated on

Security flaws are fixed regularly. Applying those fixes promptly is one of the most effective protections for a server exposed to the Internet.

Debian and Ubuntu

Install and enable unattended-upgrades:

apt update
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

Answer Yes. By default, only security updates are installed, once a day.

Some updates, such as kernel updates, only take effect after a reboot. To reboot automatically at a quiet time, add to /etc/apt/apt.conf.d/50unattended-upgrades:

Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:00";

To check the configuration without installing anything:

unattended-upgrade --dry-run --debug

Logs are in /var/log/unattended-upgrades/.

AlmaLinux and Rocky Linux

Install dnf-automatic:

dnf install -y dnf-automatic

In /etc/dnf/automatic.conf, set:

[commands]
upgrade_type = security
apply_updates = yes

Then enable the timer:

systemctl enable --now dnf-automatic.timer

What about reboots?

A server that never reboots keeps running the old kernel. Schedule a reboot at an off-peak time, or reboot it yourself from the client area after important updates.

Further reading