# How to Install Icinga 2 Monitoring Tool on Rocky Linux 8

> URL: https://www.atlantic.net/vps-hosting/how-to-install-icinga-2-monitoring-tool-on-rocky-linux-8/ | Published: 2021-12-04 | Updated: 2023-11-23 | Author: Hitesh Jethva

Icinga is a free and open-source system and network monitoring application for Linux operating systems. It is scalable and extensible and can monitor large and complex environments across multiple locations. It checks for network resources like CPU, Memory, Uptime, Processes, Disk space, and other services like HTTP, SMTP, SSH, and more. It can be configured to notify users and generates performance data for reporting.

In this post, we will show you how to install Icinga 2 monitoring tool on Rocky Linux 8.

## Step 1 – Add Icinga 2 Repository

By default, Icinga 2 is not included in the Rocky Linux 8 default repo, so you will need to add the Icinga 2 repository to your system.

First, install the EPEL repository using the following command:

```
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
```

Next, create an Icinga 2 repo with the following command:

```
nano /etc/yum.repos.d/icinga2.repo
```

Add the following lines:

```
[icinga2]
name=Icinga 2 Repository for EPEL 8
baseurl=https://packages.icinga.com/epel/8/release
enabled=1
```

Save and close the file, then import the Icinga 2 key:

```
rpm --import https://packages.icinga.com/icinga.key
```

Next, clean the package cache with the following command:

```
dnf clean all
dnf makecache
```

## Step 2 – Install and Configure MariaDB Database

Icinga 2 uses MariaDB as a database backend, so you will need to install the MariaDB server to your system. You can install it using the following command:

```
dnf install mariadb-server -y
```

Once MariaDB is installed, start and enable the MariaDB service using the following command:

```
systemctl start mariadb
systemctl enable mariadb
```

Next, secure the MariaDB installation and set the root password with the following command:

```
mysql_secure_installation
```

Answer all the questions as shown below:

```
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
```

Next, log in to MariaDB with the following command:

```
mysql -u root -p
```

Once you are logged in, create a database and user for Icinga 2:

```
CREATE DATABASE icinga;
GRANT ALL PRIVILEGES ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'password';
```

Next, flush the privileges and exit from MariaDB with the following command:

```
FLUSH PRIVILEGES;
EXIT;
```

## Step 3 – Install and Configure Icinga 2

Next, run the following command to install Icinga 2 and other required tools:

```
dnf install icinga2 icinga2-selinux icinga2-ido-mysql vim-icinga2 -y
```

Once Icinga 2 is installed, run the following command to enable the required features:

```
icinga2 feature enable command ido-mysql syslog
```

Next, import the Icinga 2 database schema to the Icinga database with the following command:

```
mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
```

Next, edit the Icinga 2 MySQL configuration file:

```
nano /etc/icinga2/features-available/ido-mysql.conf
```

Define your database settings as shown below:

```
 * The IdoMysqlConnection type implements MySQL support
 * for DB IDO.
 */

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "password"
  host = "localhost"
  database = "icinga"
}
```

Save and close the file, then start and enable the Icinga 2 service:

```
systemctl start icinga2
systemctl enable icinga2
```

To check the Icinga 2 service, run the following command:

```
systemctl status icinga2
```

You will get the following output:

```
● icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-11-17 09:22:54 UTC; 4s ago
  Process: 18616 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)
 Main PID: 18624 (icinga2)
   Status: "Startup finished."
    Tasks: 11 (limit: 11411)
   Memory: 14.2M
   CGroup: /system.slice/icinga2.service
           ├─18624 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           ├─18639 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           └─18642 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
```

## Step 4 – Install Icinga Web 2

Icinga Web 2 is a web-based application used to manage Icinga 2 from a web-based interface. By default, it is not available in the Rocky Linux default repo, so you will need to enable the Powertools repo in your system.

Run the following command to enable the Powertools repo:

```
dnf install 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
```

Next, run the following command to install Icinga Web 2 with Apache and other packages:

```
dnf install httpd icingacli icingaweb2 php-json php-ldap
```

Once all the packages are installed, start and enable the Apache and PHP-FPM service:

```
systemctl enable --now httpd
systemctl enable --now php-fpm.service
```

## Step 5 – Access Icinga Web 2 Setup Wizard

Before starting, you will need to configure the Apache webserver for Icinga Web 2. You can configure it using the following command:

```
icingacli setup config webserver apache
```

Next, generate an authentication token with the following command:

```
icingacli setup token create
```

You will get the following output:

```
The newly generated setup token is: a84a833dd624e6a0
```

Now, open your web browser and access the Icinga Web 2 setup wizard using the URL **http://your-server-ip/icingaweb2/setup**. You should see the Icinga Web 2 welcome screen:

![Icinga 2 setup page](https://www.atlantic.net/wp-content/uploads/2021/11/p1-6-1024x537.png)
 Provide your generated token and click on the **Next** button. You should see the following screen:
 ![Icinga 2 select module page](https://www.atlantic.net/wp-content/uploads/2021/11/p2-5-1024x469.png)
 Select the module that you want to enable and click on the **Next** button. You should see the following screen:
 ![Icinga 2 verify PHP extensions page](https://www.atlantic.net/wp-content/uploads/2021/11/p3-3-1024x539.png)

Make sure all the PHP extensions are installed, then click on the **Next** button. You should see the following screen:
 ![Icinga 2 select authentication page](https://www.atlantic.net/wp-content/uploads/2021/11/p4-3-1024x425.png)
 Select your authentication type and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 database details](https://www.atlantic.net/wp-content/uploads/2021/11/p5-1-1024x541.png)
 Provide your Icinga Web 2 database name, root username, password, and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 provide backend details](https://www.atlantic.net/wp-content/uploads/2021/11/p6-1-1024x440.png)
 Provide your backend name and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 provide admin username](https://www.atlantic.net/wp-content/uploads/2021/11/p7-1-1024x462.png)
 Provide your admin username and password and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 provide logging details](https://www.atlantic.net/wp-content/uploads/2021/11/p8-1-1024x487.png)
 Provide your logging details and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 verify all details](https://www.atlantic.net/wp-content/uploads/2021/11/p9-1-1024x540.png)
 Verify all details and click on the **Next** button. You should see the following screen:
 ![Icinga web 2 welcome page](https://www.atlantic.net/wp-content/uploads/2021/11/p10-1-1024x392.png)
 Click on the **Next** button. You should see the following screen:
 ![Provide Icinga 2 database name](https://www.atlantic.net/wp-content/uploads/2021/11/p11-1024x540.png)
 Provide your Icinga 2 database name, root username, password, and click on the **Next** button. You should see the following screen:
 ![configure command transport](https://www.atlantic.net/wp-content/uploads/2021/11/p12-1024x394.png)
 Configure the command transport and click on the **Next** button. You should see the following screen:
 ![configure monitoring security](https://www.atlantic.net/wp-content/uploads/2021/11/p14-1024x318.png)
 Configure monitoring security and click on the **Next** button. You should see the following screen:
 ![Verify all configuration](https://www.atlantic.net/wp-content/uploads/2021/11/p15-1024x539.png)
 Verify all settings and click on the **Finish** button. You should see the following screen:
 ![Icinga 2 setup completed](https://www.atlantic.net/wp-content/uploads/2021/11/p16-1024x489.png)
 Click on the **Login to Icinga Web 2** button. You should see the following screen:
 ![Icinga 2 login page](https://www.atlantic.net/wp-content/uploads/2021/11/p17-1024x548.png)
 Provide your admin username and password and click on the **Login** button. You should see the Icinga Web 2 dashboard on the following screen:
 ![Icinga 2 dashboard page](https://www.atlantic.net/wp-content/uploads/2021/11/p18-1024x530.png)

## Conclusion

Congratulations! You have successfully installed Icinga 2 and Icinga Web 2 on Rocky Linux 8. You can now install Icinga 2 agents on the client system and start monitoring them from the Icinga Web 2 dashboard. Try it on your [VPS](https://www.atlantic.net/vps-hosting/) from Atlantic.Net
