The short answer
Back up first, read what will change, update in a quiet window, restart the services that need it, check the site, and keep a way to roll back.
Before you start
- A recent backup or snapshot, and a note of how to restore it.
- A quiet time for the work, and someone who can test the site afterwards.
- A look at what is running:
systemctl list-units --type=service --state=running.
See what will change
# Debian and Ubuntu
sudo apt update && apt list --upgradable
# AlmaLinux, Rocky, RHEL
sudo dnf check-updateLook for the web server, database, PHP, the kernel and OpenSSL. Those are the updates that can change behaviour.
Apply
# Debian and Ubuntu
sudo apt upgrade
# AlmaLinux, Rocky, RHEL
sudo dnf upgradeRead the questions about changed configuration files. Keep your version unless you know why to replace it.
Restart what needs it
sudo needrestart # Debian and Ubuntu
sudo needs-restarting -r # Red Hat family: reboot needed?
ls /var/run/reboot-requiredA new kernel needs a reboot. Do it in your quiet window and check that all services came back.
Check
- The site, the login, a form and the payment path if there is one.
systemctl --failedand the error logs.- Disk and memory after the update.
Roll back if needed
- Restore the snapshot or backup.
- On Red Hat family systems,
dnf history undocan reverse a transaction. - Hold a problem package until it is fixed:
apt-mark hold name.
Automate the small stuff
Turn on automatic security updates for the system packages, and do the larger ones, such as database or PHP versions, by hand and with a test.
Questions people ask
How often should I update?
Apply security updates as soon as practical, within days. Do larger version changes on a plan.
Should I test updates first?
For important servers, yes. Try them on a copy first.
Can you do it for me?
Yes. Patching is part of our managed plans, with a backup first.