Regularly updating your Linux VPS ensures you have the latest security patches, software updates, and performance improvements. This guide will show you how to update and upgrade your system using the command line on popular Linux distributions like Ubuntu, Debian, CentOS, and AlmaLinux.
For Ubuntu / Debian
Step 1: Connect to Your VPS via SSH
ssh root@your_server_ip
Replace your_server_ip with your actual VPS IP address.
Step 2: Update Package Lists
This command fetches the latest package lists from the repositories:
apt update
Step 3: Upgrade Installed Packages
This installs the latest versions of currently installed packages:
apt upgrade
You may be prompted to confirm—type Y and press Enter.
Step 4: Full System Upgrade (Optional)
This handles dependency changes and removes outdated packages:
apt full-upgrade
Step 5: Remove Unused Packages
Clean up unnecessary packages:
apt autoremove
For CentOS / AlmaLinux / RHEL
Step 1: Connect to Your VPS via SSH
ssh root@your_server_ip
Step 2: Update All Packages
For CentOS 7 and earlier:
yum update
For CentOS 8, AlmaLinux, or RHEL 8+:
dnf update
Step 3: Confirm When Prompted
If updates are available, confirm with Y when asked.
Check Your Current Version (Optional)
To check your current OS version:
cat /etc/os-release
Best Practices
• Run updates regularly (weekly or as part of server maintenance).
• Reboot the VPS if a kernel or system update requires it:
reboot
• Always back up important data before major upgrades.
Conclusion
Keeping your Linux system up to date is a key part of server security and stability. If you’re unsure about applying updates or encounter any errors, feel free to contact Hosteons Support for help.