Skip to content
Menu
vernon.wenberg.net
vernon.wenberg.net
September 24, 2021February 21, 2022

Set up unattended-upgrades on Ubuntu 20.04

Package upgrades can be set up to install updates on Ubuntu without user intervention.

Install unattended-upgrades

apt install unattended-upgrades

Install mailx & Postfix

apt install bsd-mailx

If this does not install Postfix, install it now.

apt install postfix

This will install also install Postfix. mailx is what unattended upgrades uses to send external mail.

Configure unattended-upgrades.

Edit /etc/apt/apt.conf.d/50unattended-upgrades. This file is mostly self explanatory. The
options can be enabled by deleting un-commenting the line. At the very least, configure the following:

  • Unattended-Upgrade::Mail “[email protected]”; to allow sending notifications to your email address.
  • Unattended-Upgrade::Automatic-Reboot “true”; to enable auto-reboots.
  • Unattended-Upgrade::Remove-Unused-Kernel-Packages “true”; to remove kernelrelated packages. This is usually done using apt autoremove.
  • Unattended-Upgrade::Remove-New-Unused-Dependencies “true”; – remove unneeded dependancies. Also manually done with apt autoremove.
  • Unattended-Upgrade::Remove-Unused-Dependencies “false”; – remove unused packages, also, apt autoremove.

Restart unattended-upgrades.

systemctl restart unattended-upgrades

Edit /etc/postfix/main.cf. Configuration of postfix is outside the scope of this article. For my
purposes, I use a relay, so I edit and uncomment relayhost = to point to my relay.

mailx -vvv -s "Subject" [email protected]

Press CTRL D to send the email.

Test your setup.

unattended-upgrades --dry-run -–debug

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to print (Opens in new window) Print
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn

Like this:

Like Loading...

Related

Disclaimer

These posts are notes for me. These are not guides and you should not use these instructions as step-by-step instructions without knowing what they do.

Recent Posts

  • Docker Reference
  • Useful Commands for Windows Subsystem for Linux
  • FortiManager Local-In Policy
  • Mount Google Drive in Linux using rclone
  • Restore original Explorer context menus in Windows 11

Mastodon

  1. Loading Mastodon feed...

©2025 vernon.wenberg.net | Powered by WordPress and Superb Themes!
%d