Installation

The recommended way of installing Icinga is by distribution packages. Debian (Squeeze/Wheezy) and Ubuntu already have upstream packages available on Launchpad, but the latest stable version may be old (Icinga is still relatively under development, so the latest version is preferred since it will have a lot of bug fixes). Red Hat/CentOS have Icinga packages located in the RepoForge YUM repository (http://repoforge.org/). It may still be useful to build an RPM for yourself, for using backported bug fixes without having to wait for the next release. Icinga's default source tarball already has the SPEC file for RPM creation.

Building an RPM for Red Hat / Centos

This is optional and should be done only if you want to build your own RPM. Otherwise, use the RepoForge repository mentioned previously and skip this section.

Icinga's source tarball has the SPEC file for building RPMs. The procedure to build RPMs remains as usual. Create a non-root user account, and log in with that user to build the RPMs. Do not do this as the root user.

Download the Icinga source tarball and extract it. Install RPM Development Tools using the following command:

$ sudo yum install rpmdevtools

You can also install it using the following command:

$ sudo yum install @development-tools fedora-packager

Now, set up the build folder:

$ rpmdev-setuptree
$ ls ~/rpmbuild
BUILD  RPMS  SOURCES  SPECS  SRPMS

Now, copy the SPEC file from the extracted source to SPECS and the source tarball to SOURCES:

$ cp icinga.spec ~/rpmbuild/SPECS
$ cp icinga-*.tar.gz ~/rpmbuild/SOURCES

Build the final RPM packages using the following commands:

$ cd ~/rpmbuild
$ rpmbuild -bb SPECS/icinga.spec

The preceding command might give some dependency errors. Install the listed packages with yum, and run the last rpmbuild command again. If all the dependencies are fixed, the compilation should start, which usually takes some time to complete. The RPM package will be created inside the RPMS/$arch folder, where $arch is the server's architecture (i386/x86_64).

$ ls ~/rpmbuild/RPMS/x86_64
icinga-1.9.1-1.el6.x86_64.rpm
icinga-idoutils-1.9.1-1.el6.x86_64.rpm
icinga-devel-1.9.1-1.el6.x86_64.rpm
icinga-idoutils-libdbi-mysql-1.9.1-1.el6.x86_64.rpm
icinga-doc-1.9.1-1.el6.x86_64.rpm
icinga-idoutils-libdbi-pgsql-1.9.1-1.el6.x86_64.rpm
icinga-gui-1.9.1-1.el6.x86_64.rpm

The icinga package is the Icinga Core; icinga-doc provides the Icinga offline documentation; icinga-gui provides the Icinga web interface; and icinga-idoutils-* provides an optional component to store Icinga information in a database. Now, install the icinga, icinga-doc, and icinga-gui built RPMs:

$ cd ~/rpmbuild/RPMS/x86_64/
$ sudo rpm –ivh {icinga,icinga-doc,icinga-gui}-*.rpm

The installation should succeed. Now install the Apache and Nagios plugins. The nagios-plugins package provides checking of all the basic check plugins that are commonly used for monitoring:

$ sudo yum install httpd nagios-plugins

Also, install SMTP relay server (Postfix is used in the next example) and use the mail command for sending e-mail alerts:

$ sudo yum install postfix mailx

Using DEB for Ubuntu

Debian packages for Ubuntu are available at https://launchpad.net/ubuntu/+source/icinga, which can be used to install Icinga on an Ubuntu Server.

$ sudo apt-get install icinga icinga-doc

This command should install the Icinga package which is ready for use. Install the Apache and Nagios plugins:

$ sudo apt-get install apache2 nagios-plugins

Also use the postfix and mail commands:

$ sudo apt-get install postfix bsd-mailx

This setup is good enough for now. Let's continue with the next section.

Compiling from the source

Let us see how to compile Icinga from the source using the following steps:

  1. Download the Icinga source tarball and extract it:
    $ tar zxvf icinga-1.9.1.tar.gz
    $ cd icinga-1.9.1
    
  2. Run the configure script:
    $ ./configure --prefix=/usr --disable-idoutils
    

    IDOUtils is an optional module that comes with Icinga but we don't want to use it, so we use the configure script to disable the module compilation.

  3. Compile the source code:
    $ make all
    
  4. This will take some time. After it is done, it's time to install!
    $ sudo make fullinstall
    $ sudo make install-config
    

Icinga is now installed and (almost) ready for use.

We need to create a user named icinga because the Icinga server will run as this user:

$ useradd –m icinga
$ passwd icinga

Since the web server will be run as the apache user (in most cases, this is by default, and is not changed unless required by other applications using Apache), we need to add this user to the icinga group.

$ usermod –a icinga apache

The default web server user may be different for different distributions (for example, www, and so on).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.121.8