Configure Automatic Updates Ubuntu 14.04LTS

We suggest that you enable automatic updates for your AMI instance. At the least you should enable security updates. To get started install the unattended upgrades package

sudo apt-get update
sudo apt-get install unattended-upgrades

Configure unattended-upgrades

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

adjust the following to fit your needs. The configuration below will only install urgent security updates. If you want you can uncomment the updates section and get a wider selection of updates.

Unattended-Upgrade::Allowed-Origins {
        "Ubuntu trusty-security";
//      "Ubuntu trusty-updates";
};

 Enable automatic updates

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

set the appropriate apt configuration options:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

The above configuration updates the package list, downloads, and installs available upgrades every day. The local download archive is cleaned every week.

Notifications (Optional)

Editing Unattended-Upgrade::Mail in the following file

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

will enable unattended-upgrades to email an administrator detailing any packages that need upgrading or have problems.

Another useful package is apticron.  apticron will configure a cron job to email an administrator information about any packages on the system that have updates available, as well as a summary of changes in each package.

To install the apticron package, in a terminal enter:

sudo apt-get install apticron

Once the package is installed do

sudo nano /etc/apticron/apticron.conf

and set the email address and other options:

EMAIL="user@example.com"

You will need to have a mail transport agent setup on you machine to deliver the email