This is a short hands-on tutorial on creating ServerUsage RPM packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).

ServerUsage is a Free Open Source Software system to collect and process usage statistic information from multiple computers running a GNU-Linux Operating System. For more information please read the blog post: ServerUsage – Measuring users’ activity on Linux hosts.

NOTE: The commands on this guide were tested on both CentOS 6.2 and Scientific Linux 6.2 (2.6.32-220.17.1.el6.x86_64) virtual machines.

To build the RPM packages we first need a set an RPM development environment as described on the article: How to set up a build environment for RPM packages on Enterprise Linux.

Additionally you need to install SQLite 3.7.12 (or later version) and SystemTap 7 (or later version). Please follow the instructions on the follow guides to create and install the RPM packages: How to create SQLite 3 RPM packages for Enterprise Linux, How to create SystemTap 7 RPM packages for Enterprise Linux.

Once you have all required RPM packages, login as root and install them using the following commands:

$ su root
$ INSERT_YOUR_ROOT_PASSWORD
# rpm -U --force sqlite-3.7.12-1.el6.x86_64.rpm sqlite-devel-3.7.12-1.el6.x86_64.rpm
# yum remove systemtap*
# rpm -i systemtap-1.7-1.el6.$(uname -m).rpm systemtap-client-1.7-1.el6.$(uname -m).rpm systemtap-debuginfo-1.7-1.el6.$(uname -m).rpm systemtap-devel-1.7-1.el6.$(uname -m).rpm systemtap-grapher-1.7-1.el6.$(uname -m).rpm systemtap-initscript-1.7-1.el6.$(uname -m).rpm systemtap-runtime-1.7-1.el6.$(uname -m).rpm systemtap-sdt-devel-1.7-1.el6.$(uname -m).rpm systemtap-server-1.7-1.el6.$(uname -m).rpm

Once the development environment is correctly setup, login as makerpm user and download the ServerUsage sources:

$ cd ~
$ git clone git://github.com/fubralimited/ServerUsage.git

Copy the SPEC files and source files to rpmbuild dir:

$ cd ~/ServerUsage
$ export SUVER=$(cat VERSION)

$ cd ~/ServerUsage/client
$ cp serverusage_client.spec ~/rpmbuild/SPECS/
$ tar -zcvf ~/rpmbuild/SOURCES/serverusage_client-$SUVER.tar.gz  *

$ cd ~/ServerUsage/server
$ cp serverusage_server.spec ~/rpmbuild/SPECS/
$ tar -zcvf ~/rpmbuild/SOURCES/serverusage_server-$SUVER.tar.gz  *

Create the RPMs:

$ cd ~/rpmbuild/SPECS/
$ rpmbuild -ba serverusage_client.spec
$ rpmbuild -ba serverusage_server.spec

The RPMs are now located at ~/rpmbuild/RPMS/$(uname -m)

For installation and configuration instructions, please read ServerUsage – Measuring users’ activity on Linux hosts.

Nicola Asuni Systems Engineer

Nicola focused on designing, building and integrating the backend for our application platforms, including automatic deployment, monitoring and backups.