apt update vs apt upgrade: What’s the difference?

Package deal Managers are incredible!
Let me inform you what made me say that.

Options of Package deal Managers:

  • Downloads, installs and updates present software program from a repository.
  • Ensures the integrity and authenticity of the bundle.
  • Manages and resolves required dependencies.
  • Is aware of the place to place all of the recordsdata within the Linux file system.

Simply think about performing duties like checksum verification, putting in dependencies, storing elements like docs, binaries and config recordsdata in several folders manually.

Though for some bundle managers like “dpkg”, you continue to want to put in dependencies manually. However I do not know why would one use bundle managers like dpkg if we now have extra superior bundle managers which use these low degree bundle managers beneath the hood and simplifies the duty.

“apt” is one such excessive degree bundle supervisor.

Should you ever googled the way to set up <package_name> in Ubuntu machine, you’d have most likely got here throughout these instructions:

sudo apt replace
sudo apt improve
sudo apt set up <package_name>
Enter fullscreen mode

Exit fullscreen mode

You is likely to be pondering that we solely wished to put in a sure bundle so why are folks suggesting us to execute these 2 extra instructions?

Let’s perceive that.

What does apt replace do?

“apt replace” updates the bundle sources listing with the most recent variations of the packages within the repositories.

Package deal sources listing incorporates the areas or URLs of a number of the repositories from which a bundle is put in.

You’ll be able to view this listing utilizing the command :

cat /and so on/apt/sources.listing
Enter fullscreen mode

Exit fullscreen mode

It will give output:

One such location in these repositories is /ubuntu/dists/bionic-updates/principal/supply (You’ll be able to verify that here) the place Sources.gz file incorporates all of the details about the packages together with:

  • Dependencies of the bundle
  • Newest variations of the bundle
  • Checksums of the packages to confirm integrity
  • And way more as proven within the determine beneath.

Image description

So, every time we sort in apt replace it browses these lists from the repositories and copies the most recent model of them to the native system. It truly does not set up any bundle on the system.

What does apt improve do then?

“apt improve” compares the model of all of the packages at the moment put in on the system with those within the listing we fetched by means of apt replace and upgrades all of them to their newest variations.

Usually, when upgrading all of the packages within the system, we merge each apt replace and apt improve instructions in a single line:

sudo apt replace && sudo apt improve
Enter fullscreen mode

Exit fullscreen mode

All this stuff occur within the backend inside a number of seconds.

Add a Comment

Your email address will not be published. Required fields are marked *