How to Update a Linux Dedicated Server
Keeping your Linux dedicated server updated is important for security, stability, performance, and software compatibility. Regular updates can include security patches, bug fixes, kernel updates, and newer versions of installed packages.
Follow the steps below to safely update a Linux-based ApnCloud Dedicated Server.
1. Connect to Your Dedicated Server Using SSH
First, connect to your server using SSH.
Open Windows Terminal, PowerShell, Terminal, or another SSH client and enter:
ssh root@YOUR_SERVER_IP
Replace YOUR_SERVER_IP with the actual IP address of your dedicated server.
If your server uses a different administrative username, use the appropriate username instead of root.
2. Check Your Linux Distribution
Before running update commands, confirm which Linux distribution is installed on your server.
Run:
cat /etc/os-release
This usually displays information about your operating system, such as Ubuntu, Debian, AlmaLinux, Rocky Linux, or another Linux distribution.
3. Check Available Disk Space
Before installing major updates, make sure your server has sufficient free disk space.
Use:
df -h
Review the available storage carefully. A server with very little free disk space may experience update failures or service problems.
4. Update Ubuntu or Debian
If your dedicated server is running Ubuntu or Debian, first refresh the package information:
apt update
Then install the available package updates:
apt upgrade -y
For updates that may require package dependency changes, you may also use:
apt full-upgrade -y
Review major changes carefully before using full-upgrade on a production server.
5. Update AlmaLinux or Rocky Linux
For AlmaLinux, Rocky Linux, and other compatible distributions, you can normally update installed packages using:
dnf update -y
On some older compatible systems, the following command may also be available:
yum update -y
Allow the update process to finish completely before closing your SSH session.
6. Check for Failed Services
After completing the updates, check whether any system services have failed.
Run:
systemctl --failed
If failed services are listed, review them carefully before restarting or changing their configuration.
7. Check Whether a Reboot Is Required
Some updates, especially kernel and important system package updates, may require the server to be restarted.
On Ubuntu or Debian, you can check with:
test -f /var/run/reboot-required && echo "Reboot required"
If a reboot is required, schedule it at an appropriate time to minimize disruption to websites and applications hosted on the server.
8. Reboot the Dedicated Server
If necessary, restart the server using:
reboot
Your SSH connection will close automatically during the reboot.
Wait for the server to come back online before reconnecting.
9. Verify Important Services After Reboot
After the server restarts, verify that all important services are working correctly.
Check services such as:
- Web server
- Database server
- Hosting control panel
- Mail services
- Firewall
- Website applications
- Monitoring services
You can also run:
systemctl --failed
to check for failed systemd services.
10. Test Your Websites and Applications
After completing the update, manually test the websites and applications hosted on your dedicated server.
Verify that:
- Websites load correctly
- HTTPS connections work
- Databases are accessible
- Control panels are working
- Email services are functioning
- Important applications start normally
- Required network ports remain accessible
11. Remove Unused Packages Carefully
On Ubuntu or Debian, packages that are no longer required may sometimes be removed with:
apt autoremove
Review the package list before confirming removal, especially on a production dedicated server.
Do not remove packages unless you understand their purpose.
Important Update Recommendations
- Keep a recent backup before major updates
- Check available disk space before updating
- Review major package changes
- Do not interrupt an update while packages are being installed
- Perform major maintenance during a suitable maintenance period
- Check application compatibility before major upgrades
- Verify all important services after updating
Major Operating System Upgrades
Updating installed packages is different from upgrading the server to a completely new major operating system version.
A major OS upgrade can affect:
- Web server configuration
- PHP versions
- Database software
- Hosting control panels
- Firewall configuration
- Applications and dependencies
Always check compatibility and maintain a recent backup before performing a major operating system upgrade.
Need Help?
If your Dedicated Server becomes unreachable because of an ApnCloud network, service, or infrastructure issue, please open a Support Ticket from your ApnCloud Client Area.
Include your server IP address and a clear description of the issue. Never include your root password or private SSH key in a support ticket.