Get AI summaries of any video or article — Sign up free
apt, dpkg, git, Python PiP (Linux Package Management) // Linux for Hackers // EP 5 thumbnail

apt, dpkg, git, Python PiP (Linux Package Management) // Linux for Hackers // EP 5

NetworkChuck·
4 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

dpkg installs a downloaded .deb file directly but often fails when dependencies are missing, requiring manual fixes.

Briefing

Linux software installation boils down to choosing the right package manager for the job—then letting it handle dependencies, updates, and removal safely. The clearest contrast in this walkthrough is between dpkg, a low-level tool that installs a downloaded .deb file but often fails when dependencies are missing, and apt, a higher-level system that pulls packages from configured repositories and automatically resolves required dependencies.

The process starts with dpkg on a Debian-based system (the example environment is Parrot OS). After downloading Discord’s Linux installer as a .deb file from the official site, the workflow moves to the terminal: change into the Downloads directory, then run dpkg -i on the .deb. That command can fail immediately—not because dpkg can’t install, but because many applications depend on other libraries and packages. In the Discord example, missing dependencies like libappindicator1 and libstdc++6 trigger an error, forcing the user to manually hunt down additional packages.

apt is presented as the fix for that pain point. Instead of downloading .deb files directly, apt install takes a package name (like pidgin) and retrieves the correct package and dependencies from repositories. Before installing, apt update refreshes the local package index by contacting those repositories. When a dependency problem appears, apt can also repair the situation using commands like apt --fix-broken install, which installs the missing pieces so the original application can proceed.

The walkthrough also emphasizes day-to-day package management commands: apt list to view available packages, apt list --installed to see what’s already present, apt search to find packages by description, and apt show to get details about a specific package. For removal, apt remove deletes the application while preserving user data and configuration, while apt purge removes the application and its configuration. Updates are handled with apt upgrade (upgrade installed packages that have updates) and apt full-upgrade (more aggressive upgrades that may remove obsolete packages).

Beyond apt and dpkg, the guide introduces aptitude as a higher-level, “apt on steroids” interactive option, plus snap as a modern alternative built around a store (snapd). Snap installs apps with a command similar to apt install, but the source of packages is the Snap Store rather than a traditional apt repository. The example uses snap install code --classic to install Visual Studio Code.

For language-specific dependencies, the walkthrough shifts to pip3 for Python (installing requirements from requirements.txt via pip3 install -r requirements.txt) and gem for Ruby (installed via gem install). Finally, it ties everything together with git and GitHub: install git with apt, clone a repository with git clone, install Python dependencies with pip3, then run the script. The demonstration clones a GitHub tool called turbo lister, installs its Python requirements, and runs it to enumerate subdomains for hackthebox.eu—showing how package management supports real hacking workflows, not just generic software installs.

Cornell Notes

Linux package management is about selecting the right tool to install software and handle dependencies. dpkg installs a downloaded .deb file directly but commonly fails when required libraries aren’t present, as shown with Discord missing dependencies. apt solves this by using repositories: apt update refreshes package lists, and apt install fetches the requested package plus any dependencies automatically; apt --fix-broken install can repair broken installs. The guide also covers apt remove vs apt purge (data/config preservation vs full cleanup), apt upgrade vs apt full-upgrade, and alternatives like aptitude and snap (snapd + Snap Store). For programming-language projects, it uses pip3 for Python requirements and git to clone GitHub repositories, then runs the installed tool.

Why does dpkg -i often fail after downloading a .deb file?

dpkg -i installs the package you point it at, but it doesn’t automatically resolve missing dependencies. In the Discord example, dpkg reports dependency problems because required libraries (e.g., libappindicator1 and libstdc++6) aren’t installed. The result is an error even though the .deb file itself is valid.

How does apt install avoid the dependency problem dpkg hits?

apt install relies on repositories configured in sources lists. After apt update refreshes the local index from those repositories, apt install <package> downloads the requested package and also pulls in any dependencies it detects. When the system is missing dependencies, apt can also repair the situation with apt --fix-broken install.

What’s the practical difference between apt remove and apt purge?

apt remove removes the application but keeps user data and configuration files, so reinstalling later can preserve settings. apt purge removes the application and its configuration, effectively cleaning the system more thoroughly.

What do apt upgrade and apt full-upgrade change about updates?

apt upgrade upgrades installed packages that have updates. apt full-upgrade is more aggressive: it may remove previously installed packages that are no longer required to satisfy upgrade constraints, helping the system reach a consistent updated state.

When should a user consider snap instead of apt?

Snap is presented as a store-based package system (via snapd) where developers publish apps to the Snap Store. Installation uses a command similar to apt install, but the source is the store rather than apt repositories. The example installs Visual Studio Code with snap install code --classic.

How do git and pip3 fit into installing a hacking tool from GitHub?

git clone downloads the repository code onto the machine. If the project is Python-based, pip3 install -r requirements.txt installs the Python dependencies listed in the repository. After dependencies are installed, the user runs the script (e.g., turbo lister.py) to use the tool.

Review Questions

  1. In a Debian-based system, what specific step does apt update perform before apt install, and why does it matter?
  2. Describe a scenario where dpkg would be the wrong choice and explain what apt --fix-broken install does in that situation.
  3. For a Python project cloned with git, what command pattern installs dependencies from requirements.txt, and why is it needed?

Key Points

  1. 1

    dpkg installs a downloaded .deb file directly but often fails when dependencies are missing, requiring manual fixes.

  2. 2

    apt is a higher-level package manager that installs by package name using repositories and automatically resolves dependencies.

  3. 3

    Run apt update before apt install to refresh the local package index from repositories.

  4. 4

    Use apt remove to uninstall while preserving configuration/data, and apt purge to remove configuration as well.

  5. 5

    apt upgrade updates installed packages, while apt full-upgrade may remove obsolete packages to complete upgrades cleanly.

  6. 6

    snap (via snapd) installs apps from the Snap Store and can be used with commands like snap install code --classic.

  7. 7

    For GitHub-based projects, use git clone to fetch code, then pip3 install -r requirements.txt to install language-specific dependencies before running the tool.

Highlights

dpkg -i on a .deb can fail immediately due to missing dependencies, illustrated with Discord requiring additional libraries.
apt install works smoothly because it pulls both the target package and its dependencies from configured repositories.
apt remove preserves user configuration, while apt purge removes configuration too.
snap installs apps from a store (snapd) using commands similar to apt, exemplified by installing Visual Studio Code.
A complete GitHub workflow is git clone → pip3 install -r requirements.txt → run the script (turbo lister).

Topics

  • Debian Package Management
  • dpkg vs apt
  • Snap Store
  • Python pip3 Dependencies
  • GitHub with git clone

Mentioned

  • dpkg
  • apt
  • CPE
  • GUI
  • IDE
  • pip
  • pip3
  • rpm
  • sudo
  • ls
  • cd
  • cat
  • nmap
  • libc++
  • git