How to use dpkg and rpm for package management
· Category: Linux
Short answer
dpkg and rpm are low-level package managers for Debian and Red Hat systems, respectively.
Steps
- Install with dpkg:
sudo dpkg -i package.deb
- Fix broken dependencies:
sudo apt-get install -f
- Install with rpm:
sudo rpm -ivh package.rpm
- Query installed package:
dpkg -l | grep nginx
rpm -qa | grep nginx
Tips
dpkg -L packagelists files installed by a package.rpm -ql packagedoes the same on Red Hat systems.- Higher-level tools (apt, yum, dnf) resolve dependencies automatically.
Common issues
- Dependency hell: use apt/yum/dnf instead when possible.
- Force installing incompatible packages can break the system.