← Packages & Services
Linux · Packages & Services

How to update packages in Linux

Update installed packages with dnf update and apt upgrade, and apply security updates only.


Bring installed packages up to date from the repositories. Run as root.

Updates can change service versions and behaviour and may require a restart. Apply them in a maintenance window, and reboot if the kernel or glibc was updated.

# RHEL / Oracle Linux (update everything)
sudo dnf update

# Security updates only
sudo dnf update --security

# Debian / Ubuntu
sudo apt update
sudo apt upgrade

# Does the system need a reboot?
needs-restarting -r      # RHEL/OL (dnf-utils)
cat /var/run/reboot-required 2>/dev/null   # Debian/Ubuntu
LinuxUpdatesupgrade