Redhat Source Package Build

Download the following file

bsu-3.0.1-1.src.rpm

You can either build it in the /usr/src/redhat directory tree, or somewhere else where you have write privileges (like your home directory tree). An alternative location can be set with a .rpmmacros file in your home directory. This is an example of my .rpmmacros file.


%packager 	P. Michaels <pm@cgiss.boisestate.edu>
%vendor		BSU
%_topdir	/home/pm/redhat
%_prefix	/usr
%_exec_prefix    %{_prefix}
%_mandir         %{_prefix}/share/man
%_datadir        %{_prefix}/share
%_sysconfdir     %{_prefix}/etc
%_bindir         %{_exec_prefix}/bin
%_gpg_name      Paul Michaels


The %_topdir variable specifies where the package will be built. The steps are to unpack the source RPM, then cd into the SPECS directory and issue a build command. The unpack command is


rpm -ihv bsu-3.0.1-1.src.rpm


The directory tree will look something like this:

 redhat/
       |-- BUILD
       |-- RPMS
       |   |-- i386
       |   |-- noarch
       |   `-- x86_64
       |
       |-- SOURCES
       |   `-- bsu-3.0.1.tar.gz
       |-- SPECS
       |   `-- bsu-3.0.1-1.spec
       `-- SRPMS


Then change into the SPECS directory and edit the BSU spec file:


cd redhat/SPECS
vi bsu-3.0.1-1.spec


You can edit the bsu-3.0.1-1.spec file which starts like this:


%define name bsu
%define version 3.0.1 
%define release 1


And change the release to match your initials, say ``JMS":


%define name bsu
%define version 3.0.1 
%define release 1JMS


Save the edited spec file and then build the binary rpm:


rpmbuild -ba bsu-3.0.1-1.spec


If all goes well, it will build and locate a binary rpm in the redhat\RPMS directory tree. Install the binary rpm as described in section 2.6.2.

pm 2018-04-08