37 C
Jaipur
Tuesday, April 13, 2021

Difference Between apt-get upgrade and dist-upgrade

Must read

In our previous guide, we fleshed out the differences between apt update and apt upgrade. In this tutorial, we look at apt-get upgrade and apt-get dist-upgrade commands and seek to understand the difference and when each is used.

1) apt-get upgrade

According to the man pages, the command apt-get upgrade ( for older Debian/Ubuntu releases) or apt upgrade ( for newer releases such as Ubuntu 18.04 and later & Debian 10) is used to upgrade currently installed software packages to their latest versions. Under no circumstances are existing packages removed. If a package upgrade requires the removal or the installation of additional packages, the upgrade of the installed package is skipped and the package remains untouched in its current version.

Before upgrading the packages, it’s always required to update the package index first. This updates the package lists in the /etc/apt/sources.list file and /etc/apt/sources.list.d directory.

$ sudo apt-get update

Then

$ sudo apt-get upgrade
sudo-apt-get-upgrade-command
upgrade system packages

If you want to upgrade a specific and leave the rest intact simply use the syntax below:

$ sudo apt-get upgrade package-name

2) apt-get dist-upgrade

This is an enhanced version of the apt-upgrade command. Apart from upgrading existing software packages, it installs and removes some packages to satisfy some dependencies. The command includes a smart conflict resolution feature that ensures that critical packages are upgraded first at the expense of those considered of a lower priority.

To be 100% safe make sure carry out upgrade on a test environment before running on production.

$ sudo apt-get dist-upgrade
apt-get dist-upgrade command
apt-get dist-upgrade command

The main distinction between apt-get upgrade and apt-get dist-upgrade is that in the former, none of the packages are removed. Software packages with newer versions are upgraded and none whatsoever are removed. In the latter, some newer packages are installed, and some are removed to satisfy certain dependencies.

Conclusion

The apt-upgrade command will always seek to upgrade the installed software packages if newer versions are found in the repositories. It doesn’t trigger the removal of any packages. Meanwhile, apt-get dist-upgrade will delete some packages when required to do so during the upgrade of the software packages. We hope that you now have a clear understanding of the two commands and how each differs from the other. Your feedback on this brief tutorial is highly welcome.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article