How are packages actually installed via apt-get install?

Solution 1:

The advantages of a package management system such as apt, yum, pacman, emerge, etc include:

  • It's easy to query what version of a package is installed or available.
  • It's easy to remove a package entirely, making sure all its files are gone.
  • It's easy to verify the integrity of the packages files, so you can see if it's been corrupted or tampered with.
  • It's easy to upgrade a package by installing the new version and removing all the old versions files. This will make sure not to leave any lingering files from the old package around to confuse or break things.
  • It's easy to see what packages require or provide things that other packages provide or require, so you can be sure to have the needed items for the package to function correctly.
  • It's easy to install or remove groups of packages.
  • In many cases it's possible to downgrade back to a previous version of a package, for example when a new version has a bug.

Although it is for Fedora, see also:

https://fedoraproject.org/wiki/Package_management_system

Installing from source may have advantages

  • You can customize the binaries (enable / disable options)
  • More up to date package then is available in the repositories
  • Sometimes necessary for bug fixes

But the disadvantages are that you will have to then manually update the package when a new version is available and you will often loose support.

IMO if you wish to compile all or most of your packages, I would advise Gentoo.

Solution 2:

Apt-get is APT package handling utility (CLI), back-end to Synaptic and Aptitude.

The apt-get method on triggering from your system checks the official sources or repositories listed in the file

etc/apt/sources.list

For eg. on running sudo apt-get update && sudo apt-get upgrade (which i use) , runs something like

enter image description here

where the Ign (Ignore) in-front of the Link states that no change is made since last visit to that repositories , and the Get states the retrieval of Sources file stating the changes of newly available package in that Repository .

No , apt-get utility doesn't downloads the Source File , it rather downloads the .deb package packed and released by the Official Ubuntu Packagers which has been tested for Stability and Integration with your system.

The apt-get downloaded packages can be found in

/var/cache/apt

where you can see all the Updates as .deb packages , and you can even compare to cross-check their version by visiting this Precise-updates packages.

As far as Compiling from source packages is concerned , it is not advisable and not even recommended for Ubuntu 12.04 as it a LTS Release ,you can view the reasons here

Is it better to compile from source or to install from a .deb package?

Would compiling programs from source speed up my operating system?

Advantages/Disadvantages of installing from source code

For further References : apt-get, sources.list.