I am interested in knowing how software update works (technically). What all are the components that checks, downloads and installs new update and how do they work.
closed as too broad by Anwar Shah, Eric Carvalho, Braiam, chronitis, psusi Oct 14 at 13:42
There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.
That's something for a complete 600 pages book! 8-) More or less, someone gets a software project, compiles it and creates a package and stores it in a repository.
Packages receive a version so the system can recognize older and newer versions.
The package system on your computer can access the repository and see whether new versions of packages that are installed on your computer have available. If so, it offers you the possibility to upgrade.
There is a lot more to it than just that. For example, when upgrading a server you want to stop the server, do the upgrade, then restart the server. These steps are accomplished by pre and post scripts as described on this page:
Another important point, different packages may not be compatible between each others. For example, if you install Postfix you cannot also install sendmail because both offer the same functionality (although there are ways to offer both software via the alternative links.) Similarly, installing Apache and httplight would generally be in conflict because both use port 80 by default. Again, you can fix the conflict by tweaking the settings of each server, but by default the operating system is likely going to tell you that you cannot do that.
You may want to read about the Debian Policy Manual
as it gives you quite a bit of information in that regard.
Ubuntu uses apt under the hood for doing package management which provides and interface to dpkg for the actually installation, updates and removal of packages.
From Debian (as ubuntu as a Debian derivative) http://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_the_event_flow_of_the_package_management the flow is:
For info on dpkg and apt:
For info on pre and post scripts: