Blog

03/06/2019

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:

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

14/08/2019

How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...
14/08/2019

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....
12/08/2019

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...