How To Configure Automatic Updates On Ubuntu Server

by
Share this Article: Facebook21Google+0Twitter12LinkedIn0Reddit0StumbleUpon1

The unattended-upgrades is used to automatically install updated packages, either all updates or only security updates.

Let us install this package using command:

$ sudo apt-get install unattended-upgrades

Configure

To configure unattended-upgrades, we have to edit /etc/apt/apt.conf.d/50unattended-upgrades file. This file will let you to choose what updates you want to make by choosing where apt can search for new updates and upgrades. The default option is security.

$ sudo vi /etc/apt/apt.conf.d/50unattended-upgrades

and adjust as per your needs.

// 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";
};

If you want to get receive updates from updates or propsed or backports, uncomment the corresponding lines.

Blocklist packages from automatic updating

If you want to prevent a package to being updated automatically, you can add them to blocklist. To blacklist a package, navigate to Package-Blacklist section and add your packages:

// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";
};

To enable automatic updates, we need to edit /etc/apt/apt.conf.d/10periodic file,

$ sudo vi /etc/apt/apt.conf.d/10periodic

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. If you want to disable automatic updates, just change the value 1 to 0(zero).

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

Configure Email Notifications

To configure your Ubuntu server to send a mail notification to your Inbox when new updates available, install Apticorn tool in your Ubuntu server. For more information about Apticorn, refer our following tutorial.

- How to get E-mail notifications for updates On Debian/Ubuntu Using Apticorn

Cheers!

Reference: askubuntu

For questions please refer to our Q/A forum at : http://ask.unixmen.com/


Share this Article: Facebook21Google+0Twitter12LinkedIn0Reddit0StumbleUpon1