How to Enable Automatic System Updates on Your VPS
System auto-update setup on VPS
🔹 Why this matters
Automatic updates keep your server secure and up to date. The system installs security patches on its own, reducing vulnerability risks and removing the need for manual updates every time. This is especially useful for servers that work continuously and must stay stable.
⚙️ 1. Ubuntu / Debian
- Update the package list and install the auto-update module:
sudo apt update && sudo apt install unattended-upgrades -y
- Enable automatic updates:
sudo dpkg-reconfigure --priority=low unattended-upgrades
- To adjust settings manually, open the configuration file:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Make sure the following lines are enabled:
"${distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates";
- To enable automatic reboot after updates:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
Example settings:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
⚙️ 2. CentOS / AlmaLinux / Rocky Linux
- Install the auto-update utility:
sudo yum install dnf-automatic -y
- Edit the config file:
sudo nano /etc/dnf/automatic.conf
- Set the update apply mode:
apply_updates = yes
- Enable and start the update timer:
sudo systemctl enable --now dnf-automatic.timer
- Check service status:
systemctl status dnf-automatic.timer
✅ Recommendations
- Check update logs occasionally:
cat /var/log/unattended-upgrades/unattended-upgrades.log - Do not interrupt the update process.
- For critical servers, set up email or Telegram notifications.