OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

5. Automatic Updates‌


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 install unattended-upgrades


To configure unattended-upgrades, edit /etc/apt/apt.conf.d/50unattended-upgrades and adjust the following to fit your needs:


Unattended-Upgrade::Allowed-Origins { "${distro_id}:${distro_codename}"; "${distro_id}:${distro_codename}-security";

// "${distro_id}:${distro_codename}-updates";

// "${distro_id}:${distro_codename}-proposed";

// "${distro_id}:${distro_codename}-backports";

};


Certain packages can also be blacklisted and therefore will not be automatically updated. To blacklist a package, add it to the list:


Unattended-Upgrade::Package-Blacklist {

// "vim";

// "libc6";

// "libc6-dev";

// "libc6-i686";

};


image

The double “//” serve as comments, so whatever follows "//" will not be evaluated.


To enable automatic updates, edit /etc/apt/apt.conf.d/20auto-upgrades and set the appropriate apt configuration options:


APT::Periodic::Update-Package-Lists "1";

APT::Periodic::Download-Upgradeable-Packages "1";

APT::Periodic::AutocleanInterval "7";

APT::Periodic::Unattended-Upgrade "1";


The above configuration updates the package list, downloads, and installs available upgrades every day. The local download archive is cleaned every week. On servers upgraded to newer versions of Ubuntu, depending on your responses, the file listed above may not be there. In this case, creating a new file of this name should also work.


image

You can read more about apt Periodic configuration options in the /etc/cron.daily/apt script header.


The results of unattended-upgrades will be logged to /var/log/unattended-upgrades.


 

Top OS Cloud Computing at OnWorks: