How to automatically apt-get?

Derek Broughton news at pointerstop.ca
Tue Sep 25 13:12:52 UTC 2007


Josef Wolf wrote:

> Hello,
> 
> I'd like to automatically "apt-get update" and the like.  I've tried the
> following:
> 
>   #!/bin/sh
>   export DEBIAN_FRONTEND=noninteractive
>   apt-get --yes --force-yes -q update
>   apt-get --yes --force-yes -q upgrade

Besides Mario's good point about the danger of doing this, it's the hard
way.

Apt is _designed_ to do automatic updates.  You should have
a /etc/cron.daily/apt, which does the "apt-get update".  Then you need to
have the following lines in a file somewhere in /etc/apt/apt.conf.d/:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";

The first says to get the updates, the second says to download them.  At
this point they're still not installed, just downloaded. 

To actually do unattended upgrades (Ack!!!) you need to set some parameters
regarding unattended upgrades - see the Apt howto, I don't know how that's
configured.
-- 
derek





More information about the ubuntu-users mailing list