Thursday, May 2, 2024
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 2495  / 1 Year ago, sun, january 22, 2023, 4:53:06

How can I set my Ubuntu to not only update regularly (and automagically) the security updates (I could set that when installing ubuntu), but to update ALL the packages automatically, in the background, without user interaction?



Extra question: if I could configure that how often does my Ubuntu box check for update, then what should I set? Check it in every hour? Or are there any built-in random way, I mean Ubuntu waits for a random time, then it checks for updates? (to not give big traffic to the repository servers at every whole hour, e.g.: 20h; 21h; 22h; etc.)


More From » package-management

 Answers
3

Install the unattended-upgrades package, and edit its config file to install all packages, not just security updates:



Edit the file /etc/apt/apt.conf.d/50unattended-upgrades:



// Automatically upgrade packages from these (origin, archive) pairs
Unattended-Upgrade::Allowed-Origins {
"${distro_id} ${distro_codename}-security";
// "${distro_id} ${distro_codename}-updates";
// "${distro_id} ${distro_codename}-proposed";
// "${distro_id} ${distro_codename}-backports";
};


and remove the // from the parts you want to be automatic and then just save the file.



Next you need to set the autoupdate functions in /etc/apt/apt.conf.d/10periodic:



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


The update interval is every day, which is about right, otherwise you'd probably be hitting the mirror too often.



Here's the documentation for this:




[#44714] Sunday, January 22, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rhaeams

Total Points: 115
Total Questions: 111
Total Answers: 103

Location: Burundi
Member since Wed, Nov 25, 2020
4 Years ago
rhaeams questions
;