By Pierre Sarrazin
May 9th, 2007.
(See French version.)
Your system may currently have the
but not the
(If the command "
which rpmbuild" does not display anything,
you don't have
On Red Hat and Fedora systems,
rpmbuild command is provided by the
(You can give the command "
rpm -q rpm-build" to check
if it is installed.)
By default, RPM packages are built in the
/usr/src/redhat directory, which is only writable
You can have the
rpmbuild command use another
by putting this line in a file called
.rpmmacros in your home directory:
You must then create the following subdirectories in that directory:
cd /home/your_userid/rpm mkdir SOURCES SPECS BUILD SRPMS mkdir -p RPMS/i386 RPMS/athlon RPMS/i486 RPMS/i586 RPMS/i686 RPMS/noarch
See the RPM reference documentation for details.
Install the .src.rpm file this way:
rpm -i somepackage-1.0-1.src.rpm
This will create files in the
SOURCES directory of
your RPM building directory tree,
and a .spec file in the
Then go the
SPECS directory and give the command to build the RPM:
cd /home/your_userid/rpm/SPECS rpmbuild -bb somepackage.spec
-ba option instead if you also want to build the SRPM.
The binary RPM packages will typically be created in the
RPMS/i386 directory (on a PC-based system).
When a source archive (e.g., somepackage-1.0.tar.gz) contains a .spec file, one can give the following command to build the RPM without having to deploy the archive:
rpmbuild -tb somepackage-1.0.tar.gz
-ta option instead if you also want to build the SRPM.
(The source archives that I publish are supposed to contain a functional .spec file. If I omitted this, please complain to me.)