
A package manager is a collection of software tools that automates the process of installing, upgrading, configuring, and removing software on a Linux system. Think of it as the App Store or Play Store for your operating system.
The Role of a Package Manager
- Simplified Installation and Uninstallation : A package manager installs all the components of a software application with a single operation. It also keeps a database of installed software, allowing for automatic and complete uninstallation, removing all associated files and configuration information from the system.
- Dependency Resolution : Software often relies on other software (libraries). A package manager automatically finds and installs all required dependencies.
- Software Updates and Upgrades : Package managers enable automatic downloading and updating of software from online repositories. They simplify keeping the system up-to-date with the latest versions and security patches.
- Configuration Management : Package installers are designed to be aware of configuration files and typically avoid overwriting local customizations. They may back up existing configuration files or provide example files under a different name. They can also run scripts at various points during installation to perform specific configuration tasks.
- Repository Management : Most Linux software is distributed through central repositories maintained by distribution vendors and third parties. Package managers interact with these repositories to locate, download, and manage software
—
Debian/Ubuntu (APT & dpkg)
The Low-Level Tool: dpkg
- Purpose: Installs, removes, and provides info about individual
.deb package files. It does not handle dependencies.
- When to use it: When you have manually downloaded a
.deb file.
To install a package from a .deb file, you use dpkg -i package_file. This method, however, does not perform dependency resolution.
◦ To list all installed packages, dpkg -l is used.
◦ To check if a package is installed, dpkg -s package_name is the command.
◦ dpkg -S file_name can identify which package installed a specific fil
The High-Level Tool: apt
The Advanced Package Tool (APT) is a more mature and flexible high-level package management system that builds upon dpkg. It is known for being more portable and free.
◦ apt-get update refreshes the package information cache from repositories.
◦ apt-cache search search_string allows searching for packages by name or description in the repository.
◦ apt-get install package_name downloads and installs packages with full dependency resolution. This command also updates an already installed package.
◦ apt-get remove package_name is used to uninstall a package.
◦ apt-get upgrade applies all available updates to installed packages