help on src.rpm files

Barry Brimer lists at brimer.org
Sun Jul 8 14:33:57 UTC 2007


>  Iam using centos 4.5 and i want to install opensslxxx.xx.src.rpm file
>
>  how do i do it
>
>  also there is no /usr/src/redhat directory
>
>  do i have to create this directory n other directories under this
>
>  basicallly how do i install .src.rpm files in centos 4.5

You will need to install (at a minimum) the rpm-build rpm (yum install 
rpm-build).  You may also need gcc and some others as well, depending on 
what you are compiling.

It is recommended that you build packages as a non-priveleged user.  I 
create a user on my systems that I use only for this purpose.  The reason 
for this is that if there is an error in the spec file that deletes 
something that doesn't happen to mention the $RPM_BUILD_ROOT it would 
delete the file not within your package, but within your live running 
system.

To set up a build system like this, do the following.

Create a file in the home directory of the user you plan to use to build 
RPMs as called '.rpmmacros'.  It should contain the %_topdir macro with 
the full path to the directory you plan to use us your rpm building root, 
which is equivalent to /usr/src/redhat.  In my case, the contents of my 
.rpmmacros file is:
%_topdir    /home/rpmbuild/redhat

Then you need to create the directory structure to support RPM building. 
First, become the rpmbuild user, and create the 'redhat' directory in this 
user's home directory.  Then, cd into that directory and run the following 
command to create the empty directory structures:

mkdir -p {SPECS,SOURCES,BUILD,SRPMS,RPMS/{i{3,4,5,6}86,noarch}}

If you are planning to build any perl modules, I also recommend using 
cpan2rpm (http://perl.arix.com/cpan2rpm/) which will package a perl module 
into an RPM for you.  It also can create the RPM build environment for you 
by running 'cpan2rpm --mk-rpm-dirs'

Once your build environment is complete, as the rpmbuild user, you can 
either rebuild an existing SRPM with the command 'rpmbuild --rebuild 
package-name.src.rpm' or you can install the package with 'rpm -i 
package-name.src.rpm' and the edit the spec file, which will appear in the 
SPECS directory of your rpm RPM build environment and then when you are 
ready to build the package you can build it with 'rpmbuild -bb 
/path/to/spec/file'.

Hope this helps,

Barry




More information about the redhat-list mailing list