The unattended-upgrades package can be used to automatically install updated packages, and can be configured to update all packages or just install security updates. First, install the package by entering the following in a terminal:
sudo apt-get install unattended-upgrades
To configure unattended-upgrades, edit /etc/apt/apt.conf.d/50unattended-upgrades and adjust the following to fit your needs:
// "Ubuntu precise-updates";
Certain packages can also be blacklisted and therefore will not be automatically updated. To blacklist a package, add it to the list:
The double “//” serve as comments, so whatever follows "//" will not be evaluated.
To enable automatic updates, edit /etc/apt/apt.conf.d/10periodic and set the appropriate apt configuration options:
The above configuration updates the package list, downloads, and installs available upgrades every day. The local download archive is cleaned every week.
The results of unattended-upgrades will be logged to /var/log/unattended-upgrades.
Source - The official Ubuntu Server documentation.