2

As I understand things apt uses dpkg are there any operations that you can do with dpkg that can't be done with apt? as a new User to Ubuntu server do I need to learn anything about dpkg?

ams
  • 799
  • 1
  • 6
  • 11

3 Answers3

3

apt and dpkg perform different but orthogonal tasks. dpkg keeps track of what packages are currently installed, and can install or remove them. apt keeps track of what packages are available and can do things like download a package ( and its dependencies ) and hand them to dpkg to install, or check if there are newer versions of the packages you have installed, download them, and hand them to dpkg to install.

In other words, dpkg handles the low level package management, and apt builds on top of it by adding the concept of an archive that contains packages that you may want to download and install.

psusi
  • 37,551
2

AFAIK, apt can't be used to install a package from a .deb file; you’d have to use dpkg -i for that.

Otherwise, don’t worry about it. If you know your way around apt, by all means use that. If you run into limitations of apt, at least you’ll already know to look into dpkg. :-)

Martijn
  • 1,018
2

In short, dpkg can do much more than apt-*.

Ubuntu and other Debian derivatives rely on the *.deb package infrastructure.

dpkg

dpkg is the application that handles the packaging tasks of applications bundled in the *.deb files. You can do anything with it that apt can do, at a lower level. You can search, obtain information, view the files, extract, install, remove, configure, etc. with it.

dselect

dselect is a curses (terminal gui) frontend for dpkg.

apt

Apt is the Advanced Packaging Tool. With it you can automate a number of steps you would need to do by hand to obtain the results with dpkg. Apt works with the *.deb packages found in repositories to the point that you may not even know the files are there.

aptitude

aptitude is a curses (terminal gui) frontend for apt-*.

synaptic

synaptic is a gtk+ (desktop gui) frontend apt-*.

Notable usage for dpkg:

dpkg -c - Shows the contents of a deb package.

dpkg -i - Installs a deb package.

dpkg -s - Shows information about the installed package.

dpkg --reconfigure - Runs the configuration dialogs that you saw when installing the package.

Notable usage for apt-get:

apt-get install - Installs a package from your configured repositories.

apt-get remove - Uninstalls a package.

apt-get update - Updates your cache of packages within your repositories.

apt-get upgrade - Upgrades your installed packages if applicable.

apt-get dist-upgrade - Used to migrate to the latest distribution release.

apt-get autoremove - Uninstalls packages that were not explicitly installed and are not needed.

Notable usage for apt-cache:

apt-cache search - Searches to see if a specified package is available in your repositories.

apt-cache stats - Gives statistics on repositories in cache.