RPM and YUM

Extract an RPM Package

We can use rpm2cpio to extract an rpm package:

$ rpm2cpio ../libstdc++-4.3.0-8.x86_64.rpm | cpio -idv

This page http://www.rpm.org/max-rpm/s1-rpm-miscellania-rpm2cpio.html shows more example on how to use rpm2cpio.

HowTo Create A Patch File For A RPM

This article is pretty useful. One minor fix to it, is the %patch line should be 

%patch0 -p1

 

 

HowTo Create A Patch File For A RPM 

YUM Complains about Package "from installed has depsolving problems"

On a CentOS-5-i386 server, when I did "yum update", I got

perl-Module-Install-0.92-1.el5.rf.noarch from installed has depsolving problems

The entire error message is like below:

Yum Update "can't start new thread" in OpenVZ Container

In one of my OpenVZ containers, when I tried to run "yum update" today, I kept getting the error "can't start new thread". The entire error message is like this:

Loaded plugins: fastestmirror

Create User in RPM Package

In building an RPM .spec file, I wanted to create a user during pre-installation. So I had:

%pre
/usr/sbin/useradd -d /home/project/userid userid

This would fail if the directory "/home/project/" doesn't exist. My way to get aound this is to add a mkdir:

%pre
mkdir -p /home/project
/usr/sbin/useradd -d /home/project/userid userid

Newer Software Versions in CentOS

In general, the software version in CentOS are behind. It's just the way CentOS and Red Hat operate. They aim for long term support and stability.

But if you have to use a newer software package, you may find that some newer packages in CentOS's test repository, as listed in this page Available Repositories for CentOS. For CentOS 5 testing packages, you can find them in CentOS Test Repos.

YUM Download Source RPM

How do I yum install SRPM from CentOS/Red Hat site, instead of manually download the srpm from one of the ftp website?

Install yum-utils

# yum install yum-utils

Yum and RPM Tips

Get the dependency

If the package is already installed, use "rpm -qR <package-name>" to get the list of packages that this package depends on. For example:

$ rpm -qR openldap

If the package is not yet installed, use "yum  deplist <package-name>" to get the list of packages that this package depends on. For example:

Signing RPM Packages

The chapter Signing Packages in Maximum RPM explains clearly on how to sign RPM packages.

There are a few things to note though. In the page http://www.rpm.org/max-rpm/s1-rpm-pgp-getting-ready.html, it asked to put the gpg key name name path into rpmrc. This has changed. You have to put the following into ~/.rpmmacros: