Unattended Upgrades on Ubuntu or Debian Linux

Both Debian and Ubuntu have an "unattended-upgrades" package.

  • sudo aptitude install unattended-upgrades
  • sudo tee -a /etc/apt/apt.conf > /dev/null «EOD
    • APT::Periodic::Update-Package-Lists "1";
    • APT::Periodic::Unattended-Upgrade "1";
    • EOD

If you're using Debian you need to apply the following patch to /etc/cron.daily/apt. If you don't want to run patch you can just add the lines that begin with a + by hand.

--- apt~    2006-02-22 02:26:58.000000000 -0700
+++ apt 2007-10-26 10:36:46.000000000 -0600
@@ -182,5 +182,14 @@
     update_stamp $AUTOCLEAN_STAMP

+# Added locally for unattended upgrades
+eval $(apt-config shell ?UnattendedUpgradeInterval APT::Periodic::Unattended-Upgrade)
+if check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
+    unattended-upgrade
+    update_stamp $UPGRADE_STAMP
 # check cache size 

Now your computer will download and install updates every night. You probably only want to do this if you're in the stable branch.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License