How to Install Icinga Web 2 on CentOS 8

How to Install Icinga Web 2 on CentOS 8

Icinga web 2 is a web interface for Icinga, a popular network monitoring software. In this article, you will learn how to install Icinga web 2 on CentOS 8 server.


This Article Provides:


What is Icinga Web 2? :

Icinga web 2 is a PHP based web application that provides a web interface for Icinga 2 network monitoring server. Icinga Web 2 is fast, responsive, accessible and easily extensible with modules.

Icinga Web 2 provides an intuitive user interface to monitor network devices with Icinga 2. Especially there are lots of list and detail views for hosts and services. You can sort and filter depending on what you want to see.

System administrators can also control the network monitoring process itself by sending external commands to Icinga. Most such actions, like rescheduling a check, can be done with just a single click.

We have configured an Icinga 2 server on CentOS 8 in our previous post. Now we are exploring how to install Icinga Web 2 on the same CentOS 8 server.

Instructions in this article are of advance level, if you are new to Linux world then we strongly recommend you to read Red Hat RHCSA 8 Cert Guide: EX200 (Certification Guide) (PAID LINK) by Pearson IT Certification. It will provides basic to intermediate knowledge about the RHEL (Red Hat Enterprise Linux) 8, CentOS 8 or similar Linux distros.

How to Install Icinga Web 2 on CentOS 8

Environment Specification:

We are using a CentOS 8 (minimal) virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.0
  • Hostname -
  • IP Address - /24


Installing Apache Web Server with PHP on CentOS 8:

Icinga Web 2 is a PHP based web interface for Icinga 2. Therefore, we need a PHP application server to deploy it.

Connect with as root user by using a ssh client.

We are installing Apache web server and PHP by using following dnf command.

# dnf install -y httpd php-fpm php-ldap php-json

Add a default page for Apache web server. It is mandatory, or otherwise Icinga’s HTTP service will raise an 403 Forbidden Error.

# echo "HomePage" > /var/www/html/index.html
# chmod 755 /var/www/html/index.html

Start and enable Apache and PHP services.

# systemctl enable --now httpd.service php-fpm.service
Created symlink /etc/systemd/system/       /lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/      sr/lib/systemd/system/php-fpm.service.

Allow Apache service in CentOS 8 firewall.

# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload


Create a MySQL Database for Icinga Web 2:

We have already installed MariaDB on the same Linux server in our previous post. Therefore, we can now create the Icinga Web 2 backend database on the same MySQL server.

Login to MySQL server as root user.

# mysql -u root -p123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Create a MySQL database for Icinga Web 2 as follows.

MariaDB [(none)]> CREATE DATABASE icingaweb;
Query OK, 1 row affected (0.028 sec)

Create a database user for Icinga Web 2 and grant complete privileges on icinga database.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON icingaweb.* TO 'icinga'@'localhost' IDENTIFIED BY 'Ahmer@1234';
Query OK, 0 rows affected (0.143 sec)

Reload privileges table and exit from MySQL shell.

Query OK, 0 rows affected (0.066 sec)

MariaDB [(none)]> EXIT;


Installing Icinga Web 2 on CentOS 8:

We have already added the Icinga 2 yum repository in our Linux package manager. Therefore, we can easily install Icinga Web 2 and Icinga CLI using a dnf command.

# dnf install -y icingacli icingaweb2 icingaweb2-selinux

Icinga Web 2 web application runs as apache user, therefore, we need to adjust SELinux file context, so the apache user can edit Icinga Web 2 configuration files in /etc/icingaweb2 directory.

# semanage fcontext -a -t httpd_sys_rw_content_t /etc/icingaweb2
# restorecon -Rv /etc/icingaweb2
Relabeled /etc/icingaweb2 from system_u:object_r:etc_t:s0 to system_u:object_r:httpd_sys_rw_content_t:s0

Generate Icinga Web 2 configurations for Apache web server.

# icingacli setup config webserver apache
Alias /icingaweb2 "/usr/share/icingaweb2/public"

# Remove comments if you want to use PHP FPM and your Apache version is older than 2.4
#<IfVersion < 2.4>
#    # Forward PHP requests to FPM
#    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
#    <LocationMatch "^/icingaweb2/(.*\.php)$">
#        ProxyPassMatch "fcgi://$1"
#    </LocationMatch>

<Directory "/usr/share/icingaweb2/public">
    Options SymLinksIfOwnerMatch
    AllowOverride None

    DirectoryIndex index.php

    <IfModule mod_authz_core.c>
        # Apache 2.4
            Require all granted

    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from all

    SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2"

    EnableSendfile Off

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /icingaweb2/
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]

    <IfModule !mod_rewrite.c>
        DirectoryIndex error_norewrite.html
        ErrorDocument 404 /icingaweb2/error_norewrite.html

# Remove comments if you want to use PHP FPM and your Apache version
# is greater than or equal to 2.4
#    <IfVersion >= 2.4>
#        # Forward PHP requests to FPM
#        SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
#        <FilesMatch "\.php$">
#            SetHandler "proxy:fcgi://"
#            ErrorDocument 503 /icingaweb2/error_unavailable.html
#        </FilesMatch>
#    </IfVersion>

Restart Apache service to apply new configurations.

# systemctl restart httpd.service


Run Web Setup to Configure Icinga Web 2 on CentOS 8:

Generate a token for using on the Icinga web 2 setup.

# icingacli setup token create
The newly generated setup token is: da04f0b87929cec8

Open URL in a web browser.


The web setup of Icinga Web 2 has been started.

Enter the token here and click on Next.


Select the module to enable and click on Next.


Check and rectify if there is any missing requirement.

Click on Next.


Choose your preferred authentication type. We are using "Database" authentication type.

Click on Next.


Define parameters to access our MySQL data store and click on Validate configuration.

When done, click on Next.


Click on Next.


Create an admin user for Icinga Web 2 and click on Next.


Customize settings according to your requirements and click on Next.


Review the configurations that we have made so far and click on Next.


Click on Next.


Define parameters to access our MySQL data store and click on Validate configuration.


Choose "Local Command File" as Transport Type.

Click on Next.


Click on Next.


Click on Finish.


Click on Login.


Login as admin user.


We are now at the dashboard of the Icinga Web 2.


Recommended Training: Icinga2 - The definitive guide to monitoring



We have successfully installed and configured Icinga Web 2 on CentOS 8 server. Now, you can use Icinga network monitoring software more conveniently.

Post a Comment

Previous Post Next Post