# How do I enable automatic security updates on a VPS?

> How to enable automatic security updates on a VPS in 6 steps, with unattended-upgrades on Ubuntu or Debian and dnf-automatic on AlmaLinux.

- URL: https://saltvps.com/guides/how-to-enable-automatic-updates-on-a-vps/
- Last updated: 2026-11-16
- Publisher: SaltVPS (https://saltvps.com)

**Quick answer — How do I enable automatic security updates on a VPS?**

To enable automatic security updates, install unattended-upgrades on Ubuntu or Debian and run dpkg-reconfigure -plow unattended-upgrades, or install dnf-automatic on AlmaLinux and Rocky Linux and enable its timer. Both apply security patches once a day. They run the same way on all 6 **SaltVPS** images.

**In brief**

- **Debian and Ubuntu**: unattended-upgrades, switched on by two lines in `20auto-upgrades`.
- **AlmaLinux and Rocky Linux**: dnf-automatic with `apply_updates = yes` and a systemd timer.
- **Scope**: security updates only by default, which keeps surprises rare.
- **Reboots**: kernel updates need one; you choose whether it happens on its own.
- **Check**: a dry run shows what would be installed.

## How do you enable automatic security updates on Ubuntu or Debian?

**Run as root. Ubuntu images often have the package already; the steps confirm it is on.**

1. **Install the package** — Run apt update then apt install unattended-upgrades.
2. **Switch it on** — Run dpkg-reconfigure -plow unattended-upgrades and answer Yes. It writes /etc/apt/apt.conf.d/20auto-upgrades.
3. **Check the switch file** — That file should contain APT::Periodic::Update-Package-Lists "1"; and APT::Periodic::Unattended-Upgrade "1";.
4. **Choose reboot behaviour** — In /etc/apt/apt.conf.d/50unattended-upgrades, set Unattended-Upgrade::Automatic-Reboot "true"; and a time such as "04:00", or leave it off.
5. **Test with a dry run** — Run unattended-upgrade --dry-run --debug. It lists the packages it would install, without installing them.
6. **Read the log** — Later, check /var/log/unattended-upgrades/unattended-upgrades.log to see what was applied.

## How do the two update tools compare?

**Same goal, different files: pick the column that matches your system.**

*unattended-upgrades and dnf-automatic compared for automatic security updates on a VPS*

| Item | unattended-upgrades | dnf-automatic |
| --- | --- | --- |
| Systems | Debian 12/13, Ubuntu 22.04/24.04 | AlmaLinux 10, Rocky Linux 10 |
| Main config file | /etc/apt/apt.conf.d/50unattended-upgrades | /etc/dnf/automatic.conf |
| Switch on | 20auto-upgrades with two Periodic lines set to 1 | systemctl enable --now dnf-automatic.timer |
| Security only | Default origins are the security pockets | upgrade_type = security |
| Automatic reboot | Automatic-Reboot "true" | reboot = when-needed |
| Log | /var/log/unattended-upgrades/ | journalctl -u dnf-automatic |

## How do you enable automatic updates on AlmaLinux or Rocky Linux?

**Install dnf-automatic, set it to apply security updates, then start its timer.**

- `dnf install dnf-automatic`
- In `/etc/dnf/automatic.conf`, set `upgrade_type = security` and `apply_updates = yes`.
- Optionally set `reboot = when-needed` to restart after kernel updates.
- `systemctl enable --now dnf-automatic.timer`

Run `systemctl list-timers dnf-automatic.timer` to see the next run time.

## Should the server reboot on its own after updates?

**Turn it on for servers that can take a short break at night; leave it off where uptime matters more.** A new kernel only takes effect after a reboot. On Debian and Ubuntu, the file `/var/run/reboot-required` appears when one is pending.

Containers set to restart, such as a [trading bot in Docker](https://saltvps.com/guides/how-to-run-a-trading-bot-on-a-vps/ "How do I run a trading bot on a VPS?"), come back by themselves. A reboot you start from inside the server is immediate; one sent from the SaltVPS dashboard is carried out by a person, as the [reboot and reinstall page](https://saltvps.com/help/reboot-reinstall-delete/ "How do I reboot, reinstall or delete a SaltVPS server?") explains.

## What do automatic updates not cover?

**Software installed outside the package manager, and your data.** Docker images, Python packages and apps you copied in by hand need their own update routine; for Docker, `docker compose pull` then `docker compose up -d`.

Updates also cannot undo a mistake. SaltVPS checked its plan list on 16 November 2026: none of the 7 plans includes backups, so set up the [backup guide](https://saltvps.com/guides/how-to-back-up-a-vps/ "How do I back up a VPS?") too. Both are steps of the [Linux VPS security guide](https://saltvps.com/guides/how-to-secure-a-linux-vps/ "How do I secure a Linux VPS?").

## How can you tell the updates are really running?

**Check the timers, then the logs, a day after setup.** On Debian and Ubuntu, `systemctl list-timers apt-daily-upgrade.timer` shows when the next run is due. The history of installed packages sits in `/var/log/apt/history.log`. On AlmaLinux and Rocky Linux, `dnf history` lists each transaction with its date.

If nothing has run after two days, check that `20auto-upgrades` holds both lines set to 1, or that the dnf-automatic timer is enabled. A quick look once a month is enough after that.

## Automatic update questions

### Are automatic security updates safe on a server?

Security updates in stable releases are small and tested. Breakage is rare; skipped patches are the bigger risk on a public server.

### How do I enable automatic security updates on Ubuntu 24.04?

Install unattended-upgrades if missing, run dpkg-reconfigure -plow unattended-upgrades, then test with unattended-upgrade --dry-run.

### Can I include all updates, not just security?

Yes. Add the updates origin in 50unattended-upgrades, or set upgrade_type = default in automatic.conf. Expect more changes.

### How do I keep one package from updating?

Add it to Unattended-Upgrade::Package-Blacklist, or hold it with apt-mark hold. With dnf, use exclude in the config.

### Can it email me a report?

Yes, if the server can send mail. On SaltVPS, port 25 is closed, so relay through a mail provider on port 465 or 587.

**Verdict**

- **Enabling automatic security updates takes one package and a two-line switch.**
- **Decide on reboots up front**, and keep backups for what updates cannot fix.

## Sources

1. [Ubuntu Server documentation: automatic updates](https://documentation.ubuntu.com/server/how-to/software/automatic-updates/) — Canonical (2026-11-16)
2. [UnattendedUpgrades](https://wiki.debian.org/UnattendedUpgrades) — Debian wiki (2026-11-16)
3. [DNF Automatic](https://dnf.readthedocs.io/en/latest/automatic.html) — DNF project (2026-11-16)

**Run a patched server** Flake runs Ubuntu, Debian, AlmaLinux or Rocky Linux, with root over SSH and no setup fee. [Order Flake for 12 months](https://saltvps.com/app/checkout/?plan=flake&term=12m&from=guides-how-to-enable-automatic-updates-on-a-vps&lang=en) · [All guides](https://saltvps.com/guides/ "Which VPS guides and Linux tutorials does SaltVPS publish?")

---

SaltVPS: SaltVPS sells Linux KVM VPS in New York, Dallas, Los Angeles, London, Amsterdam and Frankfurt, paid in crypto with no ID document. Seven plans from 2 to 32 GB of RAM cost the same in all six cities, and on the 12-month term each is priced at least 25% under a named comparable plan of a no-KYC crypto host, read on 16 November 2026. The operator is DomaineGoat LLC, Panama.
