Monday, 17 June 2013

Understanding differences between dpkg and apt-get/aptitude tools.

dpkg only installs a package, so doing dpkg -i packageName.deb will only install this Deb package, and will notify you of any dependencies that need to be installed, but it will not install them, and it will not configure the packageName.deb because well...the dependencies are not there.

apt-get is a Package Management System that handles the installation of Deb packages on Debian-based Linux distributions. A Package Management System is a set of tools that will help you install, remove, and change packages easily. So apt-get is like a clever dpkg.



I like to think of the timeline this way:
  • They came up with a way to "store" the files of an application in a "package" so that it can be installed easily. So the Deb package (.deb extension file) was born.
  • They needed a tool to install these .deb files, so they came up with the dpkg tool. This tool, however, will just install the .deb file, but will not install its dependencies because it doesn't have those files and it does not have access to "repositories" to go pull the dependencies from.
  • Then, they came up with apt-get, which automates the problems in the previous point. Underneath the hood, apt-get is basically dpkg (so apt-get is a front-end for dpkg), but a clever one that will look for the dependencies and install them. It even looks at the currently installed dependencies and determines ones that are not being used by any other packages, and will inform you that you can remove them.
aptitude then came along, and it's nothing but a front-end for apt-get [so, it's a front-end of a front-end]. aptitude is a UI (user interface) for apt-get. If you want to see this UI, simply type aptitude in the terminal; that's aptitude, that's what it was originally created for. aptitude leverages the apt tools to provide more options and perks than apt-get. For example, aptitude will automatically remove eligible packages, while apt-get needs a separate command to do so. But, in the end, doing sudo aptitude install packageName.deb is the same as sudo apt-get install packageName.deb. There might be subtle differences here and there that I do not know about, but they will both look for the dependencies and do all that stuff.
Also, aptitude does not have Super Cow Powers.

How do I install already downloaded packages in Ubuntu?



You may wish to install a package you have downloaded from a website, rather than from a software repository. These packages are called .deb files. Because they may have been created for a different Linux distribution, you might find that there's dependency issues with Ubuntu, meaning that they may be uninstallable. 

To find a package which you have previously downloaded using Synaptic, aptitude or apt-get, look in /var/cache/apt/archives 

You can then install the package using apt-get or aptitude.  You can also use dpkg.

Simply type the following command to install a package using dpkg.
dpkg -i <packageName>

Note :  Though dpkg will resolve the dependencies and show you if they are not met, it will not automatically fetch and install them from repositories. In fact apt-get internally calls dpkg to install packages after resolving and downloading dependent packages.
t> UA-39527780-1 back to top