Automatic Security Updates

Keeping your system updated is the simplest and most effective security measure. Automatic security updates apply critical patches without manual intervention.

02

Debian / Ubuntu: unattended-upgrades

Installation

bash
apt install unattended-upgrades -y

Interactive Configuration

bash
dpkg-reconfigure --priority=low unattended-upgrades

Answer Yes to enable automatic updates.

Manual Configuration

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

Recommended configuration:

Unattended-Upgrade::Allowed-Origins { "${distro_id}:${distro_codename}"; "${distro_id}:${distro_codename}-security"; "${distro_id}ESMApps:${distro_codename}-apps-security"; "${distro_id}ESM:${distro_codename}-infra-security"; }; // Remove unused dependencies Unattended-Upgrade::Remove-Unused-Dependencies "true"; // Auto-reboot if needed (e.g., kernel update) // WARNING: server will reboot automatically! Unattended-Upgrade::Automatic-Reboot "false"; // If you enable auto-reboot, set it during low-traffic hours Unattended-Upgrade::Automatic-Reboot-Time "04:00"; // Email notification (optional) // Unattended-Upgrade::Mail "admin@example.com";

Enable the Timer

bash
nano /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"; APT::Periodic::AutocleanInterval "7";

Verify It Works

bash
# Test without installing anything
unattended-upgrades --dry-run --debug

# Log of executed updates
cat /var/log/unattended-upgrades/unattended-upgrades.log
03

CentOS / AlmaLinux / Rocky Linux: dnf-automatic

Installation

bash
dnf install dnf-automatic -y

Configuration

bash
nano /etc/dnf/automatic.conf
ini
[commands]
# Download and install only security updates
upgrade_type = security
apply_updates = yes

# Message after updates
emit_via = stdio

# For email notifications (optional)
# emit_via = email
# email_from = root@localhost
# email_to = admin@example.com

Enable the Timer

bash
# Daily updates
systemctl enable --now dnf-automatic.timer

# Verify
systemctl status dnf-automatic.timer
systemctl list-timers | grep dnf
04

Manual Update (When You Want Control)

Even with automatic updates enabled, it's good practice to periodically do a full manual update:

bash
# Debian/Ubuntu
apt update && apt upgrade -y

# For kernel updates (requires reboot)
apt full-upgrade -y
reboot

# CentOS/AlmaLinux
dnf update -y
05

Check Available Updates Without Installing

bash
# Debian/Ubuntu
apt list --upgradable

# Security updates only
apt list --upgradable | grep -i security

# CentOS/AlmaLinux
dnf check-update
dnf updateinfo list security

DeluxHost, opgericht in 2023, biedt hoogwaardige hostingoplossingen voor diverse digitale behoeften. Wij bieden gedeelde hosting, VPS en dedicated servers met geavanceerde beveiliging en wereldwijde datacenters.

© DeluxHost, Alle rechten voorbehouden. | BTW-nummer: IT17734661006
Alle systemen operationeel