Debian Ubuntu Auto Update

How-To enable system Auto Update on Debian/Ubuntu

Auto-Update setup for Debian/Ubuntu

This page describes how to setup auto-update on Debian/Ubuntu systems. All suggestions are welcome.

This will enable :

  • System APT auto upgrade including nPerfServer
  • System APT autoremove (to clean useless packages, like old kernels)
  • System reboot when needed (ex. after kernel update)

This will NOT update major versions (Debian 9 to Debian 10 or Ubuntu 16.04 to 18.04...)

Disclaimer:
Use it as your own risk. We recommend to use this only if the server is dedicated to nPerf.

Please log in as root before running the following commands. You can login as root with sudo -i

Install cron-apt

apt install cron-apt

Setup rules for cron-apt

echo 'autoremove -y' > /etc/cron-apt/action.d/9-autoremove &&\
echo 'dist-upgrade -y -o APT::Get::Show-Upgraded=true -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold' > /etc/cron-apt/action.d/5-install

Setup checks for system reboot

printf '0 8 *\t* *\troot\ttest -f /var/run/reboot-required && /sbin/reboot\n' > /etc/cron.d/autoreboot

That is all!
Your system will now be auto-updated every night.
Reboot will be performed automatically at 8.00 AM if required.