Linux RPM Notes


Linux Packages

The Linux RPM system is so convoluted and difficult to use that I've had to resort to this page of notes on how to do things.

RPMs are a great example of how to make something actually difficult to use. For an alternative, take a look at the NetBSD Package System. It actually works, it is simple, and you don't need to make a list of "how to do things with it"... You just do them.

You need to be careful installing things if you need multiple versions on the system. Upgrade or Freshen (upgrade only things which are already installed) delete the old version of a package.

Both kind of systems have a native package format that holds packages.

Then, the cool thing is that both of them have automated package managers which figure out dependencies and other problems, and take care of download the packages that you need to install the package that you want!

Notes on package stuff, trying to find when a package was installed:


RPM Commands

List all Installed Packages
rpm -q -a
Find which package a file belongs to
rpm -q -f filename
List files in an installed RPM
rpm -q -l package_name
List files in an uninstalled RPM
rpm -q -l -p package_file.rpm
What packages does this uninstalled RPM require
rpm -q -R -p package_file.rpm
rpm -qpR package_file.rpm
Which base version of linux is installed on this box
cat /etc/redhat-release
List files in a RPM
rpm2cpio package_file.rpm | cpio -t
List RPMs in order of install
rpm -qa --last

RPM Notes

Package Label

<name>-<version>-<release>.<os>.<architecture>.rpm
name
Name of the package, which can contain dashes, or even a version number of the software. For example apache-1.x versus apache-2.x as big non-compatible variations of the apache web server. A typical package name addition is -devel, which indicates a package has the headers for compiling to use that package, instead of just linking against the package for pre-compiled things.
version
Version of the package, which can contain dots and dashes. This is the version of the software, so when a software revs or a new beta becomes available, or a patch comes out, this is what changes.
release
The release can be thought of as and indivdual release of the version. That could be a recompilation, version of tool patched by the distributor (which is still the same version), built with different dependencies, or whatever.
os
A keyword indicating the "OS" the package is intended for. A few examples:
architecture
What architecture on a platform this thing is build for. Typical values on rhel are:

RPM Tools


Yum Notes

Yum is an automated package tool along the lines of apt for use with RedHat Packages. It takes care of dependencies and other issues that you would otherwise have to do manually by checking RPM dependencies and downloading and installing them all in the correct order.

Yum stands for YellowDog Update Manager, go figure.

List package versions
yum --showduplicates list package-name
Remove an installed package
yum remove package-name
[Setup to] version-lock a package so it won't be upgraded
yum install yum-versionlock
yum versionlock package-name
Find what RPM has a file
yum whatprovides /a/path

Debian / Ubuntu Tools

Debian & Ubuntu use a different package format than the RPM favored by RedHat-like linux systems. It's called dpkg. The funky thing is that most users on those platforms use the automated tool apt instead of the base package format.

List all Installed Packages
dpkg --get-selections
List Installaed Packages, including version info
dpkg --list 'shell-regexp'
Find which package a file belongs to
dpkg -S filename
List files in an installed package
dpkg -L package_name
Get status of an installed package
dpkg -s package_name
List info in an uninstalled .DEB
dpkg --info package_file.deb
What packages does this uninstalled .DEB require
apt install --simulate package_file.deb
Which base version of linux is installed on this box
cat /etc/debian_version
List / Extract files in a .DEB
dpkg --fsys-tarfile package_file.deb | tar tf -
Find a dpkg with a file
dpkg-query -S file
Find a dpkg with a name
dpkg-query -l name

Bolo's Home Page
Last Modified: Wed Jun 30 12:39:29 CDT 2021
Bolo (Josef Burger) <bolo@cs.wisc.edu>