RPM Rebuild on Linux Red Hat Enterprise

A quick howto on RPM rebuilding from source:

yum groupinstall "Development Tools"
yum install rpmdevtools
# unpack old tar.gz
tar zxvf my-package-0.0.0.tar.gz
mv my-package-0.0.0.tar.gz orig.my-package-0.0.0.tar.gz

[change interested files]

# create a new tar.gz file, preserving privileges

tar -pzcvf my-package-0.0.0.tar.gz my-package-0.0.0/

Create RPM from tar.gz

rpmbuild -tb my-package-0.0.0.tar.gz

The “-p” stays for “preserve privileges”

You got something like:

Wrote: /usr/src/redhat/RPMS/i386/my-package-0.0.0.i386.rpm
cd ~
cp /usr/src/redhat/RPMS/i386/my-package-0.0.0.i386.rpm ./
rpm -i my-package-0.0.0.i386.rpm

See also: