When installing a software via dpkg -i packageA.deb
, will the dependencies required by packageA
be downloaded and installed automatically? How is this different from using apt-get
or aptitude
?
Ubuntu – the difference between dpkg and aptitude/apt-get
aptaptitudedpkg
Best Answer
No,
dpkg
only installs a package, so doingdpkg -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 thepackageName.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. Soapt-get
is like a cleverdpkg
.I like to think of the timeline this way (the following is just me speaking from experience. It is meant to only give you an idea of this whole thing):
They came up with a way to "store" the files of an application in a "package" so that it can be easily installed. So, the Deb package (
.deb
extension file) was born.They needed a tool to install these
.deb
files, so they came up with thedpkg
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 basicallydpkg
(I like to think of it asapt-get
being a front-end fordpkg
), 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. It uses the librariesapt-get
uses and actually has an interactive UI (user interface). If you want to see this UI, simply typeaptitude
in the terminal. That'saptitude
. It leverages the libraries to provide more options and perks thanapt-get
. For example,aptitude
will automatically remove eligible packages, whileapt-get
needs a separate command to do so. But, in the end, doingsudo aptitude install packageName.deb
should at least be the same assudo 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. You can read the answer here for more information on the differences betweenaptitude
andapt-get
.Also,
aptitude
does not have Super Cow Powers.aptitude
might not be installed by default. To install it, dosudo apt-get install aptitude
or click this: aptitudeExtra
From Carlos Campderrós' comment below:
gdebi
is another tool that is kind of a mixture betweenapt-get
andaptitude
. When you use it to install a.deb
package (gdebi packageName.deb
), it will identify the missing dependencies, install them usingapt-get
, and then finally install and configure the package usingdpkg
. It even has a simple and neat GUI that gives you information about the.deb
package, the files included in the package, and what dependencies need to be installed. To see this GUI, you would dogdebi-gtk packageName.deb
. You can givegdebi
a try by installing it withsudo apt-get install gdebi
or click this: gdebiI don't want to confuse anyone, but just to give you another part of the picture, there is another popular Linux package format called RPM, and its files have the
.rpm
extension. This package format is used on RPM-based Linux distributions (such as Red Hat, CentOS, and Fedora). They use the commandrpm
to install a package, andyum
is the front-end for it, it's the clever one. So their.rpm
files are our.deb
files, theirrpm
tool is ourdpkg
tool, and theiryum
is ourapt-get
.From Paddy Landau's comment below:
alien
is a tool that converts between.rpm
and.deb
packages. So if you ever fall into the situation where you have an.rpm
package, and you want to install in on your Ubuntu (or any other Debian-based distro), you can use the commandalien rpm_packageName.rpm
to convert it to.deb
, and then install it usingdpkg
. You can do the reverse (convert.deb
to.rpm
) usingalien -r packageName.deb
.