apt, dpkg, git, Python PiP (Linux Package Management) // Linux for Hackers // EP 5
Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
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?
How does apt install avoid the dependency problem dpkg hits?
What’s the practical difference between apt remove and apt purge?
What do apt upgrade and apt full-upgrade change about updates?
When should a user consider snap instead of apt?
How do git and pip3 fit into installing a hacking tool from GitHub?
Review Questions
- In a Debian-based system, what specific step does apt update perform before apt install, and why does it matter?
- Describe a scenario where dpkg would be the wrong choice and explain what apt --fix-broken install does in that situation.
- For a Python project cloned with git, what command pattern installs dependencies from requirements.txt, and why is it needed?
Key Points
- 1
dpkg installs a downloaded .deb file directly but often fails when dependencies are missing, requiring manual fixes.
- 2
apt is a higher-level package manager that installs by package name using repositories and automatically resolves dependencies.
- 3
Run apt update before apt install to refresh the local package index from repositories.
- 4
Use apt remove to uninstall while preserving configuration/data, and apt purge to remove configuration as well.
- 5
apt upgrade updates installed packages, while apt full-upgrade may remove obsolete packages to complete upgrades cleanly.
- 6
snap (via snapd) installs apps from the Snap Store and can be used with commands like snap install code --classic.
- 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.