≡ Menu

RHEL / Fedora /CentOS Linux: Set RPM Build Environment

How do I set an rpm build environment on CentOS / RHEL / Red Hat Enterprise Linux version 6.x? How can I set rpm build environment on latest version of Fedora Linux?

You can setup a basic development environment. This includes the following tools:

=> Compilers such as GNU gcc compiler collection, bison, flex and others.Build tools such as make, autoconf, automake and others.

=> redhat-rpm-config – Red Hat specific rpm configuration files.

=> rpm-build – The rpm-build package contains the scripts and executable programs that are used to build packages using the RPM Package Manager.

You can install these tools with a single command. Open a terminal or login over the ssh session and type the following command as root user:
# yum groupinstall "Development tools"
OR
$ sudo yum groupinstall "Development tools"
Sample outputs:

 

Create directories

You need to create directories for RPM building under your home directory such as /home/nixcraft. Open a terminal and type the following command:

 ## cd to $HOME, just in case ##
cd
##  create dirs ##
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
 
## add macros (site specific) ##
echo '%_topdir %(echo $HOME)/rpmbuild' >> ~/.rpmmacros
echo '%debug_package %{nil}' >> ~/.rpmmacros

A note about Fedora Linux users

You can create directories in your home directory is using fedora-rpmdevtools. This package is not avilable on CentOS / RHEL / SL version <= 6.x. If you are Fedora Linux user, enter: # yum -y install fedora-rpmdevtools
OR
$ sudo yum -y install fedora-rpmdevtools
Login as a non-root user, and type the following command create rpmbuild directory:
$ fedora-buildrpmtree

References:
Share this tutorial on:
{ 3 comments… add one }

Leave a Comment


   Tagged with: , , , , , ,