Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:rpm [2006/10/25 23:28] a created |
linux:rpm [2010/12/12 11:46] (current) a |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Useful command list ===== | ||
+ | |||
**To install a package (i=install v=verbose h=show hash marks):** | **To install a package (i=install v=verbose h=show hash marks):** | ||
rpm -ivh package.rpm | rpm -ivh package.rpm | ||
Line 19: | Line 21: | ||
**To see what package owns a file:** | **To see what package owns a file:** | ||
rpm -qf filename | rpm -qf filename | ||
+ | |||
+ | example: | ||
+ | |||
+ | # rpm -qf / | ||
+ | | ||
+ | |||
+ | alternative with yum | ||
+ | |||
+ | # yum search deallocvt | ||
+ | | ||
+ | No Matches found | ||
+ | |||
+ | This is where yum's whatprovides (provides works in recent yum versions) command works really well: | ||
+ | |||
+ | # yum whatprovides */deallocvt | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
**To rebuild the RPM database:** | **To rebuild the RPM database:** | ||
rpm --rebuilddb | rpm --rebuilddb | ||
Line 29: | Line 51: | ||
**Mass uninstall of packages that match a pattern:** | **Mass uninstall of packages that match a pattern:** | ||
rpm -qa | grep pattern | xargs rpm -e | rpm -qa | grep pattern | xargs rpm -e | ||
+ | |||
+ | **How to extract contents of an RPM package** | ||
+ | | ||
+ | |||
+ | 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 | ||
+ | '' | ||
+ | |||
+ | | ||
+ | Name: dummy-tomcat | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | 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). | ||
+ | |||
+ |