Compiling RPMs — Glusterfs

Ayush Ujjwal
Mar 29 · 5 min read
RPM-Redhat Package Manager

Contents 📑

  1. What is an RPM?
  2. Compiling RPMs on Fedora, CentOS and RHEL.
  • Preparatory Steps
  • Common Steps

What is an RPM?

RPM Package Manager (RPM) (originally Red Hat Package Manager, now a recursive acronym) is a free and open-source package management system.[5] The name RPM refers to .rpm file format and the package manager program itself.

An RPM package can hold an arbitrary set of files. Most RPM files are “binary RPMs” (or BRPMs) containing the compiled version of some software. There are also “source RPMs” (or SRPMs) containing the source code used to build a binary package.

Wikipedia 💻

Compiling RPMs on Fedora, Centos, and RHEL

In this article we will be compiling RPMs from the git source on the following Operating Systems:

  1. RHEL
  2. Centos 5, 6, 7, 8
  3. Fedora 16–20, 32, 33

The overall steps/procedure is divided into two sections:

  1. Preparatory Steps — Steps specific to the Operating System.
  2. Common Steps — Common Steps for all the Operating Systems.

For Fedora 16–20, 32, 33

  1. Install gcc, the python-development headers, python-development tools
# sudo yum -y install gcc python-devel python-setuptools

You can also use dnf in place of yum.

2. If you’re compiling GlusterFS version 3.4, then install python-swiftclient. Other GlusterFS versions don’t need it:

# sudo easy_install simplejson python-swiftclient

For Fedora you can run the below command to prevent issues related to packages

# dnf install automake autoconf libtool flex bison openssl-devel libxml2-devel python-devel libaio-devel libibverbs-devel librdmacm-devel readline-devel lvm2-devel glib2-devel userspace-rcu-devel libcmocka-devel libacl-devel sqlite-devel fuse-devel redhat-rpm-config rpcgen libtirpc-devel make python3-devel rsync libuuid-devel rpm-build libcurl-devel -y

Now follow the Common steps.

For Centos 5.x

  1. Install EPEL.
# curl -OL `[`http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm`](http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm) # sudo yum -y install epel-release-5-4.noarch.rpm --nogpgcheck

EPEL(Extra Packages for Enterprise Linux) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).

2. Install a few packages that are required in Centos 5.x

# sudo yum -y install buildsys-macros gcc ncurses-devel \     python-ctypes python-sphinx10 redhat-rpm-config

Now go to the Common Part section to proceed further.

For Centos 6.x (only)

You’ll need EPEL installed first and some Centos-specific packages.

# sudo yum -y install `[`http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm`](http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm)# sudo yum -y install python-webob1.0 python-paste-deploy1.5 python-sphinx10 redhat-rpm-config

Now go to the Common steps to proceed further.

For Centos 8.x (only)

Install EPEL first and then some powertools package enabled.

# sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm# sudo yum --enablerepo=PowerTools install automake autoconf libtool flex bison openssl-devel \     libxml2-devel libaio-devel libibverbs-devel librdmacm-devel readline-devel lvm2-devel \     glib2-devel userspace-rcu-devel libcmocka-devel libacl-devel sqlite-devel fuse-devel \     redhat-rpm-config rpcgen libtirpc-devel make python3-devel rsync libuuid-devel \     rpm-build dbench perl-Test-Harness attr libcurl-devel selinux-policy-devel -y

The PowerTools repository is not enabled by default on CentOS 8 / RHEL 8 Linux. This repository contains a number of packages required as dependencies when installing other applications, and mostly building applications from source code.

Now proceed from step 2 of Common steps.

For RHEL 6.x(only)

Install EPEL first and then the other packages.

# sudo yum -y install `[`http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm`](http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm)# sudo yum -y --enablerepo=rhel-6-server-optional-rpms install python-webob1.0 \     python-paste-deploy1.5 python-sphinx10 redhat-rpm-config

Let’s move to the Common Steps.

Common Steps

These steps are common for Fedora and RHEL/CentOS.

NOTES for step 1 below:

  • If you’re on RHEL/CentOS 5.x and get a message about the lvm2-devel not being available, it’s ok. You can ignore it. 😅
  • If you’re on RHEL/CentOS 6.x and get any messages about python-eventlet, python-netifaces, python-sphinx, and/or pyxattr not being available, it’s ok. You can ignore them. 😅
  • If you’re on CentOS 8.x, you can skip step 1 and start from step 2. Also, for CentOS 8.x, the steps have been tested for the master branch. It is unknown if it would work for older branches.

1. Install the needed packages

# sudo yum -y install git autoconf \     automake bison dos2unix flex fuse-devel glib2-devel libaio-devel \     libattr-devel libibverbs-devel librdmacm-devel libtool libxml2-devel lvm2-devel make \     openssl-devel pkgconfig pyliblzma python-devel python-eventlet python-netifaces \     python-paste-deploy python-simplejson python-sphinx python-webob pyxattr readline-devel \     rpm-build systemtap-sdt-devel tar libcmocka-devel 

2. Clone the glusterfs repo and cd into it.

# git clone <web-url/ssh>
# cd glusterfs

3. Choose which branch to compile

If you want to compile the latest development code, you can skip this step.

To compile a specific version :

  • List the branches
# git branch -a | grep release 
remotes/origin/release-2.0
remotes/origin/release-3.0
remotes/origin/release-3.1
remotes/origin/release-3.2
remotes/origin/release-3.3
remotes/origin/release-3.4
remotes/origin/release-3.5
  • Switch to the branch with the specific version of glusterfs
# git checkout <branch>
Ex:
# git checkout release-3.4

NOTE — The CentOS 5.x instructions have only been tested for the master branch in GlusterFS git. It is unknown (yet) if they work for branches older than release-3.5.

4. Configure and compile GlusterFS

# cd extras/LinuxRPM 
# ./make_glusterrpms

And DONE! 😃

# ls -l *rpm

You will get the list of RPMs in your folder.

# ls -l *rpm 
-rw-rw-r-- 1 jc jc 3966111 Mar 2 12:15 glusterfs-3git-1.el5.centos.src.rpm
-rw-rw-r-- 1 jc jc 1548890 Mar 2 12:17 glusterfs-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 66680 Mar 2 12:17 glusterfs-api-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 20399 Mar 2 12:17 glusterfs-api-devel-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 123806 Mar 2 12:17 glusterfs-cli-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 7850357 Mar 2 12:17 glusterfs-debuginfo-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 112677 Mar 2 12:17 glusterfs-devel-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 100410 Mar 2 12:17 glusterfs-fuse-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 187221 Mar 2 12:17 glusterfs-geo-replication-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 299171 Mar 2 12:17 glusterfs-libs-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 44943 Mar 2 12:17 glusterfs-rdma-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 123065 Mar 2 12:17 glusterfs-regression-tests-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 16224 Mar 2 12:17 glusterfs-resource-agents-3git-1.el5.centos.x86_64.rpm
-rw-rw-r-- 1 jc jc 654043 Mar 2 12:17 glusterfs-server-3git-1.el5.centos.x86_64.rpm

References

Also Read

Geek Culture

Proud to geek out.

By Geek Culture

Subscribe to receive top 10 most read stories of Geek Culture — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store