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

  1. Install with dpkg:
sudo dpkg -i package.deb
  1. Fix broken dependencies:
sudo apt-get install -f
  1. Install with rpm:
sudo rpm -ivh package.rpm
  1. Query installed package:
dpkg -l | grep nginx
rpm -qa | grep nginx

Tips

  • dpkg -L package lists files installed by a package.
  • rpm -ql package does 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.