Keeping your VPS (Virtual Private Server) or VDS (Virtual Dedicated Server) updated is critical for security, performance, and compatibility. Updates patch vulnerabilities, improve stability, and occasionally introduce new features that can benefit your setup.
In this guide, we’ll walk through how to properly update your server, with dedicated instructions for different Linux distributions where necessary.
Backup your server. Always create a snapshot or backup before applying updates.
Check active users and processes. Updating may require reboots or service restarts.
Review available updates. Some updates may restart or interrupt running services.
Ubuntu and other Debian-based systems use the apt
package manager.
sudo apt update
This command refreshes the list of available updates.
sudo apt upgrade
This installs all available upgrades for currently installed packages.
sudo apt full-upgrade
This intelligently handles changing dependencies, such as removing obsolete packages.
sudo apt autoremove
This cleans up leftover libraries no longer needed.
Tip: For critical servers, consider rebooting after major updates:
sudo reboot
CentOS uses the yum
package manager for version 7, and dnf
(yum's successor) in CentOS 8.
CentOS 7: sudo yum check-update
CentOS 8: sudo dnf check-update
CentOS 7: sudo yum update
CentOS 8: sudo dnf upgrade
sudo reboot
OpenSUSE uses zypper
for package management.
sudo zypper refresh
sudo zypper list-updates
sudo zypper update
For Tumbleweed or when you want all recommended patches:
sudo zypper dist-upgrade
sudo reboot
Both AlmaLinux and Rocky Linux are binary-compatible with RHEL (Red Hat Enterprise Linux), and use dnf
(similar to CentOS 8).
sudo dnf check-update
sudo dnf upgrade
If you want to only update security-critical packages:
sudo dnf updateinfo
sudo dnf updateinfo apply security
sudo reboot
Distribution | Update Command(s) |
---|---|
Ubuntu | sudo apt update && sudo apt upgrade |
CentOS 7 | sudo yum update |
CentOS 8 | sudo dnf upgrade |
OpenSUSE | sudo zypper update |
AlmaLinux | sudo dnf upgrade |
Rocky Linux | sudo dnf upgrade |
Set up automatic updates if you want critical security patches without manual intervention.
Always test updates on a staging server if possible before applying to production.
Check your services after rebooting to ensure everything is running as expected.