Useful command list

To install a package (i=install v=verbose h=show hash marks):

 rpm -ivh package.rpm

To uninstall (erase) a package:

 rpm -e package-name

To upgrade a package:

 rpm -Uvh package.rpm

To test a package without installing (checks dependencies):

 rpm -Uvh --test package.rpm

To verify a package:

 rpm -Vvv package-name

To verify ALL installed packages:

 rpm -Va

To find installed package names matching a pattern:

 rpm -qa | grep pattern

To see what files a new package is going to install:

 rpm -qpl package.rpm

To see what files belong to an installed package:

 rpm -ql package-name

To see what package owns a file:

 rpm -qf filename


 # rpm -qf /usr/bin/free

alternative with yum

 # yum search deallocvt
 Warning: No matches found for: deallocvt
 No Matches found

This is where yum's whatprovides (provides works in recent yum versions) command works really well:

 # yum whatprovides */deallocvt
 kbd-1.15-11.fc14.x86_64 : Tools for configuring the console
 Repo        : fedora
 Matched from:
 Filename    : /usr/bin/deallocvt

To rebuild the RPM database:

 rpm --rebuilddb

To bypass running the install/uninstall scripts in a package:

 rpm -ivh --no-scripts package.rpm


 rpm -e --no-scripts package-name

Mass install:

 rpm -ivh *.rpm

Mass uninstall of packages that match a pattern:

 rpm -qa | grep pattern | xargs rpm -e 

How to extract contents of an RPM package

 rpm2cpio package.rpm | cpio -dimv

As the name implies, rpm2cpio takes an RPM package file and converts it to a cpio archive. The -i flag to the cpio command indicates that cpio is reading in the archive to extract files, and the -d flag tells cpio to construct directories as necessary. The -v flag tells cpio to list file names as files are extracted, and the -m flag tells cpio to retain previous file modification times when creating files.

Building a dummy/empty RPM

To create such a fake RPM file, first ensure that you have the rpm-build package installed. Then, save this text somewhere as dummy.spec:

 Summary: Dummy Package to provide tomcat5
 Name: dummy-tomcat
 Version: 1.0
 Release: 1
 Group: System Environment/Base
 License: Beerware
 BuildArch: noarch
 Provides: tomcat5, tomcat5-admin-webapps
 This meta-package fools other packages to think you have tomcat5 installed

Now, run the command: rpmbuild -bb dummy.spec

It will create a dummy-1.0-1.noarch.rpm which when installed, will provide tomcat5 (assuming your software looks at the provides list rather than the name list).

linux/rpm.txt · Last modified: 2010/12/12 11:46 by a
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready