RPM: Difference between revisions

From Leo's Notes
This page was last edited on 18 February 2015, at 17:36.
No edit summary
Line 21: Line 21:
  # rpm -qf /etc/hosts
  # rpm -qf /etc/hosts
  setup-2.8.14-10.el6.noarch
  setup-2.8.14-10.el6.noarch
</syntaxhighlight>
=== Extracting a rpm package ===
Go into a directory and extract it using cpio. This will dump the files in the current directory, so make a directory to avoid having your files clobbered.
<syntaxhighlight lang="bash" enclose="div">
mkdir package && cd package
rpm2cpio ~/custom-package.rpm | cpio -idmv
</syntaxhighlight>
</syntaxhighlight>


Line 27: Line 35:
  rpm -e --noscripts <package>
  rpm -e --noscripts <package>
</syntaxhighlight>
</syntaxhighlight>


== Building RPM ==
== Building RPM ==

Revision as of 17:36, 18 February 2015

Common RPM Tasks

Below are the common tasks I do with RPM.

List installed packages

 rpm -qa

Look for a specific package by name

 rpm -qi <package name>

Determine the origin of a file

 rpm -qf <path to file>

eg:

 # rpm -qf /etc/hosts
 setup-2.8.14-10.el6.noarch

Extracting a rpm package

Go into a directory and extract it using cpio. This will dump the files in the current directory, so make a directory to avoid having your files clobbered.

mkdir package && cd package
rpm2cpio ~/custom-package.rpm | cpio -idmv

Remove a package with a broken uninstall script

 rpm -e --noscripts <package>

Building RPM

Creating 32bit Dependency

In your RPM.spec file, have the following in your Requires line:

Requires: nss-pam-ldapd(x86-32)

Not:

Requires: nss-pam-ldapd.i686

Troubleshooting

Warning: RPMDB altered outside of yum.

If you ever get the error:

Warning: RPMDB altered outside of yum.

... it probably means that you ran rpm. To fix this warning, clear yum's cache and force a rebuild by running:

 yum clean all
 yum makecache