Skip to content

Upgrading Debian Packages

Debian Package Upgrade

By default, Debian releases use the snapshot from the time of release. Package upgrades require manually adding the latest apt resources.

Warning

  • Latest debian.org packages may break your application libraries stack of your existing application.
  • Please verify your application and package dependencies before upgrading to latest Debian packages.

Adding debian.org to the apt source list

echo "deb https://deb.debian.org/debian bookworm main contrib non-free" > /etc/apt/sources.list.d/debian_update.list
echo "deb-src https://deb.debian.org/debian bookworm main contrib non-free" >> /etc/apt/sources.list.d/debian_update.list
echo "deb https://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list.d/debian_update.list
echo "deb-src https://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list.d/debian_update.list

Updating the package repo

apt-get update

Upgrading to the latest package

apt-get --only-upgrade install <package name>

Note: The --only-upgrade option upgrades the package only if it is already installed, without actually installing any new packages.

For example, to upgrade apache2, use the following command.

apt-get --only-upgrade install apache2