To keep your VPS as secure as possible, we recommend performing regular updates. In this article, you will read how to update your software and the kernel on your operating system via the command-line for each operating system.
-
Important: Older operating systems that have reached end-of-life status no longer receive security updates and therefore pose a security risk. There is also a chance that software will not function correctly if you update the kernel from an external repository despite this. We therefore strongly recommend reinstalling the VPS with a newer operating system.
- All kernel updates (and some software updates) are only processed after restarting the server (or the relevant service). It is therefore necessary to restart the VPS after the update. In the rare event that there is a problem with the update in question, or with your configuration, you will find out immediately and can, if necessary, immediately restore a backup.
- To be safe, check for new software again after restarting your VPS following a kernel update (using the commands in this article): some software updates depend on the kernel update before you can install them.
Updating software and kernel
You can check the current kernel version of your Linux distro with the command:
uname -sr
Update the software and kernel of your operating system using the steps below. Please note that sometimes newer kernel versions are available in external repositories than are supported by the official repositories. However, additional steps are required to make use of them.
CentOS 7 (EoL)
sudo yum -y updateThe official repositories support a maximum of kernel version 3.x. To install Linux kernel version 4.x in CentOS 7, use the commands:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
CentOS Stream, AlmaLinux and Rocky Linux
sudo dnf upgrade --refresh -y
sudo rebootIf you want to check if a reboot is needed, you can use needs-restarting on many RPM-based systems:
sudo needs-restarting -rDo you get a message that needs-restarting is not installed? Then install DNS-Utils first:
sudo dnf install -y dnf-utils
Debian & Ubuntu
sudo apt update
sudo apt full-upgrade -y
sudo rebootOn Debian and Ubuntu systems, you can check if a restart is required with:
test -f /var/run/reboot-required && echo "Restart required" || echo "No restart required reported"
Windows Server
To update Windows Server, open the Start menu and type 'Update'. Then click on 'Check for updates' to see if updates are available. After the check, you can immediately run available updates.
FreeNAS
To update FreeNAS, use this article from the documentation.
FreeBSD
Update the base system and then the installed packages:
sudo freebsd update fetch install
sudo pkg update
sudo pkg upgrade
sudo reboot
OpenBSD
Update the base system and then the installed packages:
sudo freebsd-update fetch install
sudo pkg update
sudo pkg upgrade
sudo reboot
Fedora
sudo dnf upgrade --refresh
Gentoo
emerge --sync
emerge -uDU --keep-going --with-bdeps=y @world
openSUSE en SUSE Linux Enterprise
sudo zypper refresh
sudo zypper update -y
sudo rebootYou can check which processes use old files to confirm you need a reboot with:
sudo zypper ps -s
Arch Linux
sudo pacman -Syu
sudo reboot