Enabling automatic security updates

RHEL/Centos

Start off by installing yum-cron.

# Install yum-cron
$ sudo yum install yum-cron

# Configure yum-cron
$ sudo vim /etc/yum/yum-cron.conf

Set the following

update_cmd = security
apply_updates = yes

Finally start yum-cron and enable it so it’ll start automatically on boot.

$ sudo systemctl enable yum-cron
$ sudo systemctl start yum-cron

via Servers for Hackers

Debian

# Install unattended-upgrades
$ sudo apt install unattended-upgrades

# Select "yes" to confirm that you want to install stable packages.
$ sudo dpkg-reconfigure --priority=low unattended-upgrades

# Run it manually the first time to see that everything works
$ sudo unattended-upgrades -v

via Linux Audit