Building Icinga on Amazon Linux

As part of a datacenter to cloud migration for $WORK I recently needed to move our Icinga install to AWS. However, there is no current Icinga package for Amazon Linux. There exists a set of rpms when using rpmforge, but Amazon Linux is already setup for EPEL instead. The way forward? Build the rpms.

It actually wasn't very hard at all. I spun up a builder instance, built the rpms, copied them to an S3 bucket and then installed them on a fresh instance. Here's the steps:

1. prep the builder instance as root, getting all the dependencies installed.

yum -y --enablerepo=epel install fedora-packager rpmdevtools
yum -y --enablerepo=epel install gcc gd-devel zlib-devel libpng-devel libjpeg-devel libdbi-devel perl-ExtUtils-Embed
yum -y --enablerepo=epel install httpd-devel php php-devel php-gd php-ldap php-pdo php-xml php-pear
useradd makerpm

2. Never build an rpm as root. Use the "makerpm" user:

sudo su - makerpm
cd rpmbuild/
cat > .rpmmacros << EOF
%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3
%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot

3. Build icinga-core rpms:

sudo su - makerpm
cd rpmbuild/SOURCES/
wget https://github.com/Icinga/icinga-core/releases/download/v1.11.0/icinga-1.11.0.tar.gz
tar zxvf icinga-1.11.0.tar.gz icinga-1.11.0/icinga.spec
mv icinga-1.11.0/icinga.spec ../SPECS/
rmdir icinga-1.11.0
cd ..
rpmbuild -ba --define="_vendor redhat" SPECS/icinga.spec

4. Build icinga-web rpms:

sudo su - makerpm
cd rpmbuild/SOURCES/
wget https://github.com/Icinga/icinga-web/releases/download/v1.11.0/icinga-web-1.11.0.tar.gz
tar zxvf icinga-web-1.11.0.tar.gz icinga-web-1.11.0/icinga-web.spec
mv icinga-web-1.11.0/icinga-web.spec ../SPECS/
rmdir icinga-web-1.11.0
cd ..
rpmbuild -ba --define="_vendor redhat" SPECS/icinga-web.spec

This process leans heavily on the Build Icinga RPMS page which is based on the How to create an RPM package page.

Ratings and Recommendations by outbrain