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
?
-
1Related (especially regarding dependencies): askubuntu.com/q/40779/250300– MelebiusCommented May 15, 2018 at 8:28
4 Answers
No, 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 (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.A
.deb
file contains the files needed by an application to run, as well as (I like to call it) "meta-data" that holds other information, such as the names of the dependencies the application needs. If you want to see the contents of a.deb
file, you can use the commanddpkg -c packageName.deb
, and if you want to see this "meta-data" information, use the commanddpkg -I pacakgeName.deb
(and if you want to only see the dependencies, dodpkg -I packageName.deb | grep Depends
).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 libraries apt-get
uses and actually has an interactive UI (user interface). If you want to see this UI, simply type aptitude
in the terminal. That's aptitude
. It leverages the libraries 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
should at least be 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. You can read the answer here for more information on the differences between aptitude
and apt-get
.
Also, aptitude
does not have Super Cow Powers.
EDIT: Apparently, it does.
aptitude -v[v[v[v[v]]]] moo
.
aptitude
might not be installed by default. To install it, do sudo apt-get install aptitude
or click this: aptitude .
Extra
The following information doesn't really directly answer "What is the difference between dpkg and aptitude/apt-get?" but it contributes to the big picture.
From Carlos Campderrós' comment below:
gdebi
is another tool that is kind of a mixture between apt-get
and aptitude
. When you use it to install a .deb
package (gdebi packageName.deb
), it will identify the missing dependencies, install them using apt-get
, and then finally install and configure the package using dpkg
. 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 do gdebi-gtk packageName.deb
. You can give gdebi
a try by installing it with sudo apt-get install gdebi
or click this: gdebi .
I 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 command rpm
to install a package, and yum
is the front-end for it, it's the clever one. So their .rpm
files are our .deb
files, their rpm
tool is our dpkg
tool, and their yum
is our apt-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 command alien rpm_packageName.rpm
to convert it to .deb
, and then install it using dpkg
. You can do the reverse (convert .deb
to .rpm
) using alien -r packageName.deb
.
-
4Also, you can use
gdebi
(apt-get install gdebi-core
) that mixesapt-get
/aptitude
withdpkg
. You call it withgdebi some_package.deb
and it will analyze its dependencies, callapt-get
to install the missing ones and when all dependencies are fulfilled, then calldpkg
to finally install your package. Commented Jun 17, 2013 at 14:25 -
-
2@Alaa Under Extra, you can also mention that
alien
converts packages between.rpm
and.deb
. This is useful for packages available for RPM but not for DEB (or vice-versa). For example,alien packagename.rpm
to make it usable for Ubuntu. Commented Jun 25, 2013 at 9:44 -
1@AlaaAli
aptitude
is not a frontend forapt-get
. Both programs are frontends for thelibapt-pkg
library. Commented Oct 3, 2014 at 22:59 -
1@edwardtorvalds AskUbuntu is a question and answer site. Search for your answer here on the site from the thousands of old questions, and if you don't find it, ask your own question, more experienced people than me will hopefully also answer.– Alaa AliCommented Nov 20, 2014 at 17:17
apt-get
Package management via apt-get
runs hand-in-hand with the /etc/apt/sources.list
file.
apt-get install <package_name>
installs a new package onto your computer.
apt-get build-dep <package_name>
This command searches the repositories and installs the build dependencies for . If the package is not in the repositories it will return an error.
apt-get install <package1_name> <package2_name> <package3_name>
apt-get allows multiple package installation. separate the packages with a space.
auto-apt run <command_string>
When invoked, the auto-apt command automatically installs packages upon missing file access. If a program tries to access a file known to belong in an uninstalled package, auto-apt will install that package using apt-get
. This feature requires apt and sudo to work.
Visit the apt-get instruction page
aptitude
aptitude
provides the functionality of dselect
and apt-get
as well as many additional features not found in either program.
aptitude
has a shell of its own which is keyboard or mouse activated and runs in a terminal window
aptitude build-dep <package>
- Install the build-dependencies of packages - which means the packages needed to compile (or build) its source package. For example, many packages need debhelper
or autotools
to be built, but don't need them to run.
Visit the aptitude instruction page
dpkg
is a tool to install, build, remove and manage Debian packages. link
dpkg -i <package.deb>
installs a Debian package onto your computer. It does not install any dependencies as far as I can find out from the help files.
For details type dpkg --help
into a terminal window.
Guides
a guide to file management can be found here
Although there are great answers to this question I want to say something more detailed.
dpkg
(orrpm
in Fedora family) is a Low-level tool which installs and removes package files, it doesn't install the dependencies or search it from repositories.apt
,apt-get
andaptitude
(oryum
anddnf
in Fedora family) are High-level - or as it mentioned in first answer a front-end ofdpkg
! - tools that perform metadata searching and dependency resolution.
I like to explain their differences in package management tasks in Linux:
- For install, uninstall or updating a package from repositories, I use high level ones(
apt-get install
,apt-get update
,apt-get remove
) but for install and upgrade from a package file, I use low level ones(dpkg -i package_file
, ). - For search in repositories, I use high level tool (
apt-cache search search_str
) - For checking the installed packages and files I use low level ones
(
dpkg -l
or-s
or-S
for more info check the manualman dpkg | less
) - For package metadata I use high level ones, for example
apt-cache show dpkg
.
I think the most important thing and also a difference is to note is that you should use apt-get
tool to install packages. (apt
or aptitude
is fine as well).
This is because dpkg
is meant to install packages without installing dependent packages.
Because of that just installing a package with dpkg
, may lead to a later problem where dependency resolution may end up with a broken system.
You should use the command line apt-get
or apt
(since 14.04) tool to install packages. These tools are using dpkg
for you and at the same time do have the dependency resolution mechanism inside.