Package management and software installation
This domain, Package management and software installation, tests installing, removing, querying, and verifying software on both major package families, plus knowing when a source build is the right answer.
Two families
- Debian and Ubuntu:
dpkgis the low-level tool andaptresolves dependencies.apt updaterefreshes metadata,apt upgradeorfull-upgradeinstalls updates, andapt install,apt remove,apt purge,apt search, andapt showdo the rest. Query withdpkg -l,dpkg -L pkg, anddpkg -S /path. - RHEL, Fedora, and SUSE:
rpmis low-level anddnf(orzypper) resolves dependencies. Usednf install,dnf remove,dnf upgrade,dnf search,dnf info, anddnf provides /path; query withrpm -qa,rpm -ql pkg, andrpm -qf /path. - Repositories are defined in
/etc/apt/sources.listplussources.list.dor in/etc/yum.repos.d/*.repo, and GPG keys verify metadata.
Source installs
./configure && make && make install places files under /usr/local by default. This bypasses the package database, so updates and removal become your responsibility. Prefer distribution packages unless you need a specific version or a compile-time option.
Worked example
You need to know which package owns /usr/sbin/sshd. On Debian, run dpkg -S /usr/sbin/sshd; on RHEL, rpm -qf /usr/sbin/sshd. Reasoning: both query the local package database's file lists, which is faster and more reliable than guessing from the binary name. The inverse question, which package would provide a missing file, is answered by dnf provides '*/sshd' or apt-file search.
Traps
- Mixing
dpkg -iwithaptand leaving dependencies broken instead of runningapt -f install. - Installing an RPM built for another distribution or architecture.
- Removing a library package that other packages depend on.
- Assuming
apt updateupgrades software; it only refreshes metadata.