> For the complete documentation index, see [llms.txt](https://docs.anyone.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anyone.io/relay/maintenance/unattended-upgrades.md).

# Unattended Upgrades

Automatically keep your entire system up to date.

This configuration will enable your entire system to upgrade itself to always keep it up to date and perform automatic reboots if required.

1. `sudo apt-get install unattended-upgrades`
2. Add below to `/etc/apt/apt.conf.d/50unattended-upgrades`:

```bash
Unattended-Upgrade::Origins-Pattern {
    "origin=Debian,archive={{ ansible_distribution_release }}";
    "origin=Debian,archive={{ ansible_distribution_release }}-security";
    "origin=Debian,archive={{ ansible_distribution_release }}-updates";
    "origin=Debian,archive=stable-backports";
    "origin=Anon";
};
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "03:00";
```

3. Add below to `/etc/apt/apt.conf.d/20auto-upgrades`:

```bash
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1"
```

4. `sudo systemctl restart unattended-upgrades`
