Keeping your VPS updated is one of the most important and simplest maintenance tasks — it applies security patches, fixes bugs, and keeps installed software current. This guide covers the standard APT-based update process for both Ubuntu and Debian.
Prerequisites
- Ubuntu or Debian VPS
- Root or sudo access
Step 1 — Check Your Current Version
cat /etc/os-release
Step 2 — Refresh the Package List
sudo apt update
This retrieves the latest package information from your configured repositories — it does not install anything yet.
Step 3 — See What Will Be Updated
apt list --upgradable
Step 4 — Install Available Updates
sudo apt upgrade -y
Step 5 — Perform a Full Upgrade (When Needed)
Some updates require installing or removing dependent packages. Use full-upgrade when apt upgrade reports held-back packages:
sudo apt full-upgrade -y
On production servers, review the proposed package changes before confirming.
Step 6 — Remove Unused Packages
sudo apt autoremove -y
sudo apt autoclean
Step 7 — Check If a Reboot Is Required
test -f /var/run/reboot-required && echo "Reboot required" || echo "No reboot required"
Step 8 — Reboot Safely
sudo reboot
Your SSH session will close. Wait a minute, then reconnect.
Verifying Services After a Reboot
sudo systemctl --failed
This lists any services that failed to start — investigate and restart them if needed.
Common Errors
Package repository error — check your internet connection and confirm the repository entries in /etc/apt/sources.list are correct for your distribution version.
Broken packages:
sudo apt --fix-broken install
dpkg was interrupted:
sudo dpkg --configure -a
Best Practices for Production Servers
- Take a snapshot or backup before major upgrades
- Apply security-only patches automatically (see Automatic Security Updates), and review feature upgrades manually
- Schedule reboots during a maintenance window
- Verify critical services after every reboot
FAQ
How often should I update?
Check for security updates weekly at minimum; automatic security updates are recommended for continuous protection between manual reviews.
Does apt update install anything?
No — it only refreshes the package index. You must run apt upgrade to actually install updates.
Related Articles
- How to Enable Automatic Security Updates on Ubuntu & Debian
- VPS Security Checklist for Beginners
- How to Reboot a Linux VPS Safely
