Learn how to – How To Install Icinga Web 2 on CentOS 8 / RHEL 8.
In our last article, we covered the installation of Icinga 2 on CentOS 8 / RHEL 8 Linux machine. This is a continuation guide discussing how you can install Icinga Web 2 on CentOS 8 / RHEL 8. Icinga Web 2 is a powerful PHP framework for web applications that comes in a clean and reduced design. It’s fast, responsive, accessible and easily extensible with modules.
We’ll install Icinga Web 2 from packages available on the official Icinga2 package repositories. After installation, the setup and configuration is done from a web interface with the help of a setup wizard.
Step 1: Install Icinga 2 on CentOS 8 / RHEL 8
You have to start with the installation of Icinga 2 using our guide below.
After installation of Icinga 2 server, proceed to install Icinga Web 2 on CentOS 8 / RHEL 8 Linux system.
Step 2: Install Icinga Web 2 on CentOS 8 / RHEL 8 Linux
Enable PowerTools repository and EPEL.
sudo dnf install -y 'dnf-command(config-manager)'
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf config-manager --set-enabled powertools
If you’re running RHEL 8, consider enabling additional repositories.
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo subscription-manager repos --enable=rhel-8-server-optional-rpms --enable=rhel-8-server-extras-rpms
Then add the repository contents for Icinga Web 2 to our system.
sudo dnf -y install https://packages.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm
Here is my installation output:
Last metadata expiration check: 0:02:42 ago on Sat 28 Dec 2019 09:03:06 AM EAT.
icinga-rpm-release-8-4.el8.icinga.noarch.rpm 8.3 kB/s | 9.5 kB 00:01
Dependencies resolved.
========================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================
Installing:
icinga-rpm-release noarch 8-4.el8.icinga @commandline 9.5 k
Transaction Summary
========================================================================================================================================================
Install 1 Package
Total size: 9.5 k
Installed size: 2.6 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : icinga-rpm-release-8-4.el8.icinga.noarch 1/1
Verifying : icinga-rpm-release-8-4.el8.icinga.noarch 1/1
Installed:
icinga-rpm-release-8-4.el8.icinga.noarch
Complete!
Update package index:
sudo dnf makecache
Install Apache web server ans Icinga Web 2 on CentOS 8 / RHEL 8 Linux using the commands:
sudo dnf install httpd icingacli icingaweb2 nagios-plugins-all
The dependency packages like PHP and other extensions will be installed from the AppStream repository.
Also perform an installation of PHP and required modules:
sudo dnf module reset php -y
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf module install php:remi-8.0
sudo dnf -y install php-cli php-pdo php-common php-mysql php-curl php-json php-zip php-gd php-xml php-mbstring php-pecl-mailparse php-imap php-ldap php-imagick
We need to start httpd, service and configure firewalld.
sudo systemctl enable --now httpd
sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload
Also start PHP-FPM service.
sudo systemctl enable --now php-fpm.service
Icinga Web 2 configuration file is: /etc/httpd/conf.d/icingaweb2.conf
Put SELinux in Permissive Mode
For easy setup, consider disabling SELinux or putting it in permissive mode.
sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
cat /etc/selinux/config | grep SELINUX=
Before doing the next steps, confirm httpd and php-fpm services are in running state:
$ systemctl status php-fpm httpd
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-12-28 09:14:58 EAT; 9min ago
Main PID: 12132 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 11512)
Memory: 27.6M
CGroup: /system.slice/php-fpm.service
├─12132 php-fpm: master process (/etc/php-fpm.conf)
├─12270 php-fpm: pool www
├─12271 php-fpm: pool www
├─12272 php-fpm: pool www
├─12273 php-fpm: pool www
└─12274 php-fpm: pool www
Dec 28 09:14:58 centos8.novalocal systemd[1]: Starting The PHP FastCGI Process Manager...
Dec 28 09:14:58 centos8.novalocal systemd[1]: Started The PHP FastCGI Process Manager.
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Sat 2019-12-28 09:14:58 EAT; 9min ago
Docs: man:httpd.service(8)
Main PID: 12131 (httpd)
Status: "Running, listening on: port 80"
Tasks: 213 (limit: 11512)
Memory: 25.1M
CGroup: /system.slice/httpd.service
├─12131 /usr/sbin/httpd -DFOREGROUND
├─12133 /usr/sbin/httpd -DFOREGROUND
├─12134 /usr/sbin/httpd -DFOREGROUND
├─12135 /usr/sbin/httpd -DFOREGROUND
└─12136 /usr/sbin/httpd -DFOREGROUND
Dec 28 09:14:58 centos8.novalocal systemd[1]: Starting The Apache HTTP Server...
Dec 28 09:14:58 centos8.novalocal httpd[12131]: Server configured, listening on: port 80
Dec 28 09:14:58 centos8.novalocal systemd[1]: Started The Apache HTTP Server.
Step 2: Configure Icinga Web 2 on CentOS 8 / RHEL 8
Run the commands on CLI to start configurations:
sudo icingacli setup config webserver apache
Generate authentication token required for web setup. In order to generate a token use the command:
$ sudo icingacli setup token create
The newly generated setup token is: 89f98cfcccbbeef4
Starting Web Setup
Finally visit Icinga Web 2 in your browser to access the setup wizard and complete the installation: /icingaweb2/setup
.
http://[serverip_or_hostname]/icingaweb2/setup
You’re presented with a welcome page which looks like this:
Paste token generated earlier and click next. In case you do not remember the token you can show it using the icingacli:
$ sudo icingacli setup token show
The current setup token is: 89f98cfcccbbeef4
On the next page, select the modules to enable:
Confirm requirements then proceed to setup database.
Fill and validate database configs.
- MariaDB database installation guide: Install MariaDB on CentOS / RHEL 8
- PostgreSQL database installation: Install PostgreSQL on CentOS 8 | RHEL 8
Example of database creation on MariaDB database server for Icinga2:
$ mysql -u root -p
CREATE DATABASE icingaweb2;
GRANT ALL PRIVILEGES ON icingaweb2.* TO 'icingaweb2'@'localhost' IDENTIFIED BY 'StroNgP@ssw0d';
FLUSH PRIVILEGES;
EXIT;
Input database connection details and click on “Validate Configuration” before you hit “Next” button
Configure backend name.
Create the first admin user:
Configure Logging:
Configure Monitoring IDO resource
Monitoring IDO Resource database was created in the guide and can be checked on the following file in your Icinga2 server.
$ sudo cat /etc/icinga2/features-available/ido-mysql.conf
/**
* The IdoMysqlConnection type implements MySQL support
* for DB IDO.
*/
object IdoMysqlConnection "ido-mysql" {
user = "icinga"
password = "StroNgP@ss"
host = "localhost"
database = "icinga"
}
Fill and validate if connection is successful
Command Transport
Here you define how you want to send commands to your monitoring instance (Icinga2 server)
You have to run the api setup on the Icinga 2 host where you want to send the commands to:
$ sudo icinga2 api setup
information/cli: Generating new CA.
information/base: Writing private key to '/var/lib/icinga2/ca//ca.key'.
information/base: Writing X509 certificate to '/var/lib/icinga2/ca//ca.crt'.
information/cli: Generating new CSR in '/var/lib/icinga2/certs//frankubuntu20.novalocal.csr'.
information/base: Writing private key to '/var/lib/icinga2/certs//frankubuntu20.novalocal.key'.
information/base: Writing certificate signing request to '/var/lib/icinga2/certs//frankubuntu20.novalocal.csr'.
information/cli: Signing CSR with CA and writing certificate to '/var/lib/icinga2/certs//frankubuntu20.novalocal.crt'.
information/pki: Writing certificate to file '/var/lib/icinga2/certs//frankubuntu20.novalocal.crt'.
information/cli: Copying CA certificate to '/var/lib/icinga2/certs//ca.crt'.
information/cli: Adding new ApiUser 'root' in '/etc/icinga2/conf.d/api-users.conf'.
information/cli: Reading '/etc/icinga2/icinga2.conf'.
information/cli: Enabling the 'api' feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Updating 'NodeName' constant in '/etc/icinga2/constants.conf'.
information/cli: Created backup file '/etc/icinga2/constants.conf.orig'.
information/cli: Updating 'ZoneName' constant in '/etc/icinga2/constants.conf'.
information/cli: Backup file '/etc/icinga2/constants.conf.orig' already exists. Skipping backup.
Done.
Now restart your Icinga 2 daemon to finish the installation:
sudo systemctl restart icinga2
The default generated ApiUser object for authenticating against the Icinga 2 API is in the file below:
$ sudo cat /etc/icinga2/conf.d/api-users.conf
/**
* The ApiUser objects are used for authentication against the API.
*/
object ApiUser "root" {
password = "733313f70d81ed81"
// client_cn = ""
permissions = [ "*" ]
}
You can modify then restart icinga2 service or use as provided:
Finalize the installation Icinga Web 2 on CentOS 8 / RHEL 8 Linux system then login using the link provided in success page.
This is the end of our guide on how one can install and configure Icinga Web 2 on CentOS 8 / RHEL 8 Linux system. We hope this article was of great help to you. If you encounter any issues or errors at setup time ping us and we’ll be happy to help.
Leave a Reply
You must be logged in to post a comment.