How do I enable automatic updates?
Solution 1
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.
Solution 2
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.
Solution 3
In the Update Manager click the Settings
button. This dialog will show up:
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:
- https://help.ubuntu.com/community/AutomaticSecurityUpdates#Using_the_.22unattended-upgrades.22_package
- How to enable silent automatic updates for any repository?
- How do I enable automatic updates of all packages?
Solution 4
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.
Solution 5
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.
Related videos on Youtube
Comments
-
David Siegel almost 2 years
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?
-
Admin over 9 years
-
Admin over 2 yearsSee also: ubuntu.com/server/docs/…
-
-
Marcel Stimberg almost 14 yearsAlthough I agree that those crontabs entries are not the way to go: apt-get upgrade -y is not that bad. From the man page for -y: "If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort."
-
Weboide almost 14 yearsBut an important package for your server, web application, etc might not be an "essential" package and could potentially get removed.
-
Eliah Kagan about 12 years
unattended-upgrades
is preferable butapt-get -y upgrade
is not wrong or dangerous at all.sudo apt-get upgrade
will never (with or with outy
, with or without explicit user approval) install any new package or uninstall any installed package. (Fromman apt-get
: "under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed.") Remember, the-y
flag can be used with other, potentially more dangerous commands thanupgrade
, such asdist-upgrade
. -
redanimalwar about 10 years-1 Disappointing this has selected since this is not answering the question correctly and is showing a thing everybody who know Ubuntu a little bit and pays attention in dialogs knows this already. The most upvoted answer is the right one.
-
redanimalwar about 10 yearsThis is lacking the info that you have to set
APT::Periodic::Download-Upgradeable-Packages "0";
to 1 and should also setAPT::Periodic::AutocleanInterval "0";
to something in days in/etc/apt/apt.conf.d/10periodic
or not? Also you would not be do this instead of the GUI way if you would only security updates so you also have to uncomment// "${distro_id}:${distro_codename}-updates";
in/etc/apt/apt.conf.d/50unattended-upgrades
to really have automatic upgrades for all code packages. This can then be extended to update even more. -
Karel Bílek over 8 yearsHow often will the update run now, after I set this up?
-
Weboide over 8 yearsdaily, according to /etc/cron.daily/apt
-
Diskdrive over 8 yearsWhat happens with updates that require a server reboot?
-
Weboide over 8 yearsA file will be created by the system (/var/run/reboot-required) to let you know that a reboot is required. But no actions are taken by unattended-upgrades to restart the system though, it's up to you to restart it.
-
jgindin almost 8 yearsofficial docs talk about enabling notifications as well (via email), which i think is good for those who wish to know. help.ubuntu.com/lts/serverguide/automatic-updates.html
-
fredley over 7 yearsHow can I do this without needing to interact with the prompt?
-
pihentagy almost 4 yearsCan I do it without a prompt? (So turn on unattended upgardes unattended :) )
-
Harsha over 3 yearsThis doesn't upgrade my LTS automatically, does it?
-
Harsha over 3 yearsDoes this also update my LTS version from 18 to 20?
-
majorgear over 2 years@Harsha No. you need to run dist-upgrade for that as new releases require a new kernel, and upgrade will never install a new kernel.
-
daviewales over 2 yearsThe official docs appear to have moved here: ubuntu.com/server/docs/…