Department of Computer Science and Technology

Package managers

What is a ".deb" ?

.deb is used on Ubuntu and debian systems. The "low level" command is dpkg and the "higher level" command more normally used is apt-get.

Useful dpkg commands

  • dpkg-query -w: list all installed packages.
  • dpkg -l $regexp: list all the packages matching $regexp, their status and a brief description.
  • dpkg -I$package.deb: show information about $package.
  • dpkg -S $name: look for packages with the file $name.
  • dpkg -c package.deb: list the contents of the package.

What is an "RPM" ?

This conted is mostly relevant to users of older systems or non-managed machines.

RPM Package Manager (originally Red Hat Package Manager, abbreviated RPM) is a package management system. It is used on Fedora and CentOS systems. The name RPM refers to two things: a software package file format, and a "low level" software tool which installs, updates, uninstalls, verifies and queries software packaged in this format. This page will use the convention that an RPM (upper case) is a file in the RPM format, but rpm (lower case) is the command which operates upon such files. The "higher level" command more normally used than rpm is yum.

Useful rpm commands

  • rpm -qa: List all the RPMs installed on a given machine (missing off the .rpm extension)
  • rpm -q packagename: List the packagename-version-release part of the RPM name of an installed package called packagename, e.g. "rpm -q evince" returns evince-0.6.0-6.fc6.
  • rpm -q --qf '%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' packagename: List the RPM name of an installed package called packagename, but with the component parts of the name separated out,
    e.g. "rpm -q --qf '%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' finger" returns finger 0.17 i386
  • rpm -qi packagename: Display information about the installed package called packagename, e.g. "rpm -qi evince" returns
  • rpm -qf filename: Find out which RPM a given file comes from. e.g. "rpm -qf /usr/bin/evince" returns evince-0.6.0-6.fc6.
  • rpm -qpl rpmname: List all the files that an RPM (in this directory) called rpmname will install.
  • rpm -ivh rpmname: Not particularly useful to most users who don't know root passwords, but included here for completeness. Install an RPM from a file (in this directory) called rpmname. This will fail unless run as root as the RPM needs to update the "installed package" database, which needs root privileges. It will also fail if the RPM depends on another package which is not yet installed - if you want to insist that it gets installed anyway add the --nodeps option.
  • rpm -e packagename_and_version: Uninstall a package - if there are multiple RPMs with the same packagename this will need both the name of the package and its version number, otherwise just the packagename. If other RPMs are dependent on this RPM then this will fail - you need to uninstall those other RPMs first.
  • rpm --rebuilddb: Rebuild the installed packages database if things get confused.
  • rpm -q --scripts packagename: Look at the scripts the RPM will run as part of the installation and uninstallation processes.(Of specialist interest only !)