Automatic Updates for Ubuntu – with all updates.

Call me a risk taker, I allow all of my systems to update everything automatically.  Managing 50+ systems on a daily basis can become a daunting task if you don’t.  I would rather cleanup after a bad update than after an attack.  At least with the update I know what happened.  This is why I configured automatic updates for Ubuntu.

So here is how I configure Automatic Updates in Ubuntu:
Packages needed: cron-apt, unattended-upgrades

  • apt-get install cron-apt
  • apt-get install unattended-upgrades
That’s it for the packages, now let’s get things configured:

First we need to edit the 50unattended-upgrades file located in /etc/apt/apt.conf.d/.  I use nano, you can us any editor you are comfortable with.

  • nano /etc/apt/apt.conf.d/50unattended-upgrades
    Mine looks like this:
  •  I simply edited the comment ” // ” out of these lines. too enable non-critical or non-security updates.  This will allow all of the updates I want.

    which now reads
  • Then I changed


    which does the cleanup of unneeded dependencies.
  • Next I changed the lines that reads

    to read

    to enable automated reboots
  • And finally, changed
  • to read as

    to allow automatic reboots at 4:00 am as necessary.
  • I didn’t make any other changes because I use monitoring software that reports update statuses.

Next we edit 10periodic (or 2periodic, I don’t think it matters.  I’m not sure what the difference is, if there is any.  I just know that some documentation reads 10 periodic and some 2periodic.  I don’t recommend having both files, just use on or the other)  Both files use commands that are well documented in the file /etc/cron.daily/apt.  (There is no need to edit /etc/cron.daily/apt, just read it).

  • nano /etc/apt/apt.conf.d/10periodic

Then verify that /etc/apt/apt.conf.d/20auto-upgrades is correct:

  • nano /etc/apt/apt.conf.d/20auto-upgrades

Reboot your system and give it 24 hours.  You should notice that all of you updates are being installed automagically! 

Note I set my automatic updates for Ubuntu happen daily, this is my preference, you may want to change it to weekly, to reduce overhead.  I highly suggest reading the documentation to fully understand what is going on.  This is simply a guide to how I do it, use it to get going then fine tune it to your preferences. Written for Ubuntu 14, works with Ubuntu 15 and 16, I’m testing 17.