How to Update and Upgrade Your Ubuntu or Debian VPS

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
  • apt update, apt upgrade, ubuntu update, debian update, vps maintenance
  • 0 Корисниците го најдоа ова како корисно
Дали Ви помогна овој одговор?

Понудени резултати

How to Enable and Configure Swap on a Linux VPS (Ubuntu & Debian)

Swap is disk space Linux can use as overflow memory when physical RAM is exhausted. It won't make...

How to Manage Services with systemd and systemctl

systemd is the service manager used by Ubuntu, Debian, and most modern Linux distributions to...

How to Read and Analyze Linux Logs with journalctl

On modern Ubuntu and Debian systems, journalctl is the central tool for viewing system and...

How to Schedule Tasks with Cron on a Linux VPS

Cron is the standard Linux job scheduler, used to automate recurring tasks like backups, log...

How to Check and Manage Disk Usage on a Linux VPS

Running out of disk space can bring down databases, break log writing, and crash applications....