2014-03-27

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
rpmdev-setuptree
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
EOF

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.

2 comments:

Richard said...

You are my hero! Thank you so much; built flawlessly.

Unknown said...

Works great on icinga version 2 as well, although you have to modify the spec file to remove the systemd requirement for el>=7. It looks like AWS linux might not be moving to systemd anytime soon.

Simply set that to 0, and you should be good to go, as long as you have added the additional dependencies.


openssl-devel gcc-c++ libstdc++-devel cmake flex bison boost-devel mysql-devel postgresql-devel

Ratings and Recommendations by outbrain