Prerequisites
Before updating your server, make sure you have:
- SSH access to your VPS (username:
hxroot) - Your server IP address
- Root or sudo user password
Why Regular Updates Are Important
Keeping your server updated is critical for:
- Security - Patches for known vulnerabilities
- Performance - Bug fixes and optimizations
- Stability - Improved system reliability
- Compatibility - Support for new software versions
Method 1: Update Ubuntu/Debian Servers (APT)
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22Update package lists (checks for available updates):
apt updateUpgrade all packages to latest versions:
apt upgrade -yFor a full system upgrade (including kernel):
apt full-upgrade -yRemove unnecessary packages:
apt autoremove -yReboot if kernel was updated:
rebootMethod 2: Update CentOS/Rocky/AlmaLinux (YUM/DNF)
For CentOS 7 and older:
yum update -yFor Rocky/AlmaLinux 8+ and CentOS 8+:
dnf update -yClean up old packages:
dnf autoremove -yMethod 3: Set Up Automatic Security Updates
For Ubuntu/Debian, install unattended-upgrades:
apt install unattended-upgrades -ydpkg-reconfigure --priority=low unattended-upgradesSelect "Yes" when prompted to enable automatic updates.
For CentOS/Rocky, enable automatic updates:
yum install dnf-automatic -ysystemctl enable --now dnf-automatic.timerCheck Your Current OS Version
lsb_release -aOr for older systems:
cat /etc/os-releaseCheck Available Updates Without Installing
Ubuntu/Debian:
apt list --upgradableCentOS/Rocky:
yum check-updateView Update History
Ubuntu/Debian:
grep " install " /var/log/dpkg.logCentOS/Rocky:
yum history⚠️ Important: Always back up important data before running major system updates. Some updates may require a server reboot.
Best Practices
- Run updates at least once a week
- Test updates on a staging server first (if possible)
- Schedule updates during low-traffic hours
- Keep a backup before kernel updates
- Monitor your server after updates