Debian Auto update / Unattended update

Here's a quick way, to enable Debian to autoupdate.
1. Install unattended upgrades and mailx.
#> apt-get install unattended-upgrades bsd-mailx
2. Configure the upgrades
#> vi /etc/apt/apt.conf.d/50unattended-upgrades

Normally the default configuration should be ok; if you want to change anything, please read the comments in the file which make the configuration self-explaining. For example, you can specify the upgrade origins (default: stable and security), you can blacklist packages that should not be updated, you can have the system email you if there are problems, you can have the system remove unused dependencies after an update, or you can make the system do an automatic reboot if this is needed after an update. Please note: The double slashes // serve as a comment; anything that follows a comment in the same line will not be evaluated.

3. Then create file /etc/apt/apt.conf.d/02periodic to enable it.


// Enable the update/upgrade script (0=disable)
APT::Periodic::Enable "1";

// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Update-Package-Lists "1";

// Do "apt-get upgrade --download-only" every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages "1";

// Run the "unattended-upgrade" security upgrade script
// every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::Unattended-Upgrade "1";

// Do "apt-get autoclean" every n-days (0=disable)
APT::Periodic::AutocleanInterval "7";


Unattended upgrades will run once per day from the cron /etc/cron.daily/apt
The script will log to the file /var/log/unattended-upgrades/unattended-upgrades.log