It is a best practice to update your server on a regular schedule for security and stability. Use this guide to keep your Debian server updated.
This guide applies to:
Always make a backup before updating your system.
This command updates the package lists from the enabled repositories.
$ sudo apt update
This step is optional. To view the upgradable packages before performing the upgrade, use the
apt list command.
$ sudo apt list --upgradable
This command will upgrade all the upgradeable packages.
$ sudo apt upgrade
$ sudo reboot
If you want to accept all the defaults and perform the upgrade without intervention, use this command:
$ sudo apt update && sudo apt upgrade -y
Use apt to remove old packages and dependencies automatically.
$ sudo apt autoremove
Periodic updates keep your server secure and stable. Make sure you have a snapshot or backup strategy in place before updating.