Skip to content

Q&A · Answered

How to set up automatic security updates on Ubuntu

asked 9 months, 1 week ago 1259 views 1 answer
17

I want my Ubuntu server to automatically install security updates. How do I configure unattended-upgrades?

1 Answer

One accepted
24

Accepted answer

Not confirmed since it was written, 9 months, 1 week ago

Install unattended-upgrades

sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Configure settings

# Edit /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
    "${distro_id}:${distro_codename}-security";
};
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:00";

Enable automatic updates

# Edit /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

Your answer

Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.

Shown beside your answer and never checked, so it cannot be a name someone already has here.

No account needed to answer. Sign in instead and it carries your name and earns reputation.