164

Update Manager is constantly offering me updates (e.g. security fixes, updates from PPAs).

How can I tell my Ubuntu installation to automatically download and install updates whenever they become available?

Seth
  • 59,332
David Siegel
  • 9,022

6 Answers6

188

Although it is not wrong or dangerous (see comments to this answer), using apt-get upgrade -y is not the best way to achieve this.

unattended-upgrades is one of the best practices of having automatic updates, especially for headless machines or servers!

You can set up unattended-upgrades pretty easily by typing this in a terminal:

sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

From the description:

 This package can download and install security upgrades automatically
 and unattended, taking care to only install packages from the
 configured APT source, and checking for dpkg prompts about
 configuration file changes.
Weboide
  • 10,783
41

In the Update Manager click the Settings button. This dialog will show up:

screenshot of Download and install automatically security updates

Select the "Download and install automatically". This will automatically install security updates. If you want to set this up for them remotely via, you can do this:

sudo apt-get install unattended-upgrades

If the package is installed already you can do:

sudo dpkg-reconfigure unattended-upgrades

to change it's behavior. Follow the prompts to enable the feature once you run the command. There's currently no graphical method to just set the entire system to update unattended for everything (you want to play it safe when it comes to automatic upgrades), but setting security updates automatically is a good idea.

Check out the pages for more information if you want to automate getting -updates and -backports:

Jorge Castro
  • 73,717
29

You can do this easily for security updates.

From System Settings open Update Manager. Click the 'Settings...' button, then on the 'Updates' tab, select the radio button 'Install security updates without confirmation.'

To automatically install all updates, see the answer below.

thisfred
  • 716
25

Go to terminal, and enter:

sudo dpkg-reconfigure unattended-upgrades

Say "yes" to the prompt. You'll still be notified about "normal" updates, such as those that contain bugfixes, but security updates will be installed automatically.

lfaraone
  • 4,749
10

I use apticron to get informed by mail if an update needs to be done.

In your case, I would use cron-apt or unattended-upgrades to do the job of automagically updating your machines.

rubo77
  • 34,024
  • 52
  • 172
  • 299
ddeimeke
  • 3,149
0

Wrote a script to regularly and automatically download and apply security fixes, and reboot if necessary. Should work on Debian, Ubuntu and friends.

To install:

curl -L -s https://silentupgrades.johnbyrd.com | sudo bash

To uninstall:

curl -L -s https://silentupgrades.johnbyrd.com | sudo bash -s -- --uninstall

No warranty expressed or implied.

johnwbyrd
  • 101