The Debian Series: package managers

David E Lares S
Nov 5, 2019 · 4 min read

In the previous story of this series, I spoke a little bit about users and groups management in our Debian 7 machine.

Another crucial thing about using additional software is the fact that is installed and accessed through package managers.

Different from Windows OS systems, in Debian and general Linux OS’s you will find software on repositories (also on binaries). The OS itself comes with repositories sources (a bunch of several secure URL’s where you can download any kind of software) maintained by the community behind Debian or by particular companies involved, where you just can simply go and download whatever you need and install it using CLI commands.

There’s a lot of PM’s for Debian, tools like aptitude, dpkg, synaptic, tasksel and apt are the most popular ones. Almost everyone works in a similar way but I will dig into each one next.

Aptitude

aptitude is a tool that can manage packages with Debian. This tool is no longer maintained anymore and not exists on Debian 9 instances. It presents itself as a high-level interface for package management.

aptitude works just like apt and the other package managers, it contains commands just to update, upgrade, delete and perform package-related actions with it. The command for aptitude is aptitude and pretty much goes along with descriptive arguments that define the intended actions, for example:aptitude search [program] . This is a command to find a specific program on a bunch of source repositories.

This also works with other arguments that you can reference from the documentation itself.

Before using it (and if we have a fresh install), it’s pretty much recommended to update the source list on the OS in order to get the most recent packages possible. This applies to ALL package managers (consider it as a pro-tip :)).

There are 2 main commands that work slightly differently on, in essence, do the same, and a purge command(or deletion command) that will be explained right away.

the aptitude update command updates the local package source list and compares it versus the source list of the mirrored servers of Debian available worldwide, once the comparison is done, it downloads the versions to the local package source.

The aptitude upgrade updates the installed programs in the OS.

And the aptitude purge that deletes software installed and also removes all the configuration settings around.

For most common package managers, the location of the programs is on the /etc/apt/sources.list directory. You can access it through GUI as well if my memory doesn’t fail there’s a tool for aptitude called TUI that is a terminal user interface, an alternative for terminal users.

Let’s move on to the apt tool.

apt

This is also a tool for managing packages but in an advanced way, as a matter of fact, APT stands for Advanced Package Tool.

This tool is way more sophisticated than dpkg and has more commands than aptitude with several similarities but with a lot of more functionality, you can download, upgrade mirror servers, remove and purge installed packages, but also you can visualize installed package information, revisit dependencies, and more, plenty more.

The apt command works with certain arguments in order to get specific tasks done. The apt-get command handles installations, upgrades, and packages deletion processes while apt-cache find and shows software information, dependencies, and repository sources of the OS.

apt uses the /etc/apt/sources.list file listing installed package source repositories.

dpkg

Is the Debian Package manager, this is also a package manager that works directly with .deb files.

This is a low-level tool that lets you run and manage .deb files installation process easily from the CLI. I’m not pretty sure if it works with the apt source directory, but is more straightforward on how to use it. I will move you into some examples and see it for yourself.

  1. which dkpg : if you are a regular Linux user, you will see that the which command points to you to the location of the selected program.
  2. dpkg -l : list of installed programs
  3. dpkg -i [package.deb] : installing a .deb file
  4. dpkg -r [package] : removing a package
  5. dpkg -L [program] : this command lists the content of the installed software
  6. dpkg -l | grep [program] : this command (along with the grep and the pipe), checks if a program is already installed in the OS.

I’m pretty sure that this explanation can drive you to use dpkg in an efficient way.

Great, but, what about GUI tools?

From the initial list, we still missing the synaptic and the tasksel tools. But there’s nothing much to tell about it.

synaptic is a GUI tool to manage packages, extremely similar to aptitude

Tasksel has a different approach because is task-oriented, as a matter of fact, Tasksel is a TUI (Interface on the terminal), to manage the installation of software based on tasks.

tasksel is more intuitive, and also goes along with self-explanatory command and arguments. Here’s a quick example: tasksel --list-tasks

Once again, I’m trying to generate some basic and quick lectures to provide an introductory text for each key component of Debian environments.

Please feel free to expand it if you want to.

More to come, stay tuned.

Happy coding :)

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

David E Lares S

Written by

Backend Developer, Pentesting and InfoSec Student

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.