1080*80 ad

Installing Icinga Web 2 on Debian 10

How to Install and Configure Icinga Web 2 on Debian 10: A Comprehensive Guide

In the world of IT infrastructure management, robust and reliable monitoring is non-negotiable. Proactively identifying issues with servers, services, and network devices is key to maintaining uptime and performance. Icinga is a powerful, open-source monitoring system that provides extensive flexibility and scalability to keep a close watch on your entire environment.

While the Icinga 2 core engine handles the heavy lifting of executing checks and processing results, Icinga Web 2 provides the fast, intuitive, and modern web interface needed to visualize that data. This guide will walk you through the complete process of installing and configuring Icinga Web 2 on a Debian 10 (Buster) server.

Prerequisites

Before we begin, ensure you have the following:

  • A server running a fresh installation of Debian 10 (Buster).
  • Root or sudo access to the server.
  • A static IP address configured for your server.

Step 1: System Preparation and Updates

First, let’s prepare the system by updating the package lists and upgrading existing packages to their latest versions. This ensures a clean and secure foundation.

Open your terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

Next, we need to install some essential packages that will be required for adding new repositories and for the web stack.

sudo apt install -y apt-transport-https wget gnupg

Step 2: Install the Web Stack (Apache, MariaDB, and PHP)

Icinga Web 2 is a PHP application that requires a web server and a database to function. We will use the popular and stable combination of Apache as the web server and MariaDB as the database server.

Install Apache, MariaDB, and the necessary PHP packages with a single command:

sudo apt install -y apache2 mariadb-server php php-gd php-mbstring php-mysql php-curl php-ldap php-intl php-xml php-zip

Once the installation is complete, it’s a good practice to enable and start the Apache and MariaDB services to ensure they launch automatically on boot.

sudo systemctl enable apache2
sudo systemctl start apache2
sudo systemctl enable mariadb
sudo systemctl start mariadb

Step 3: Secure Your MariaDB Installation

A default MariaDB installation is not secure. We must run the provided security script to set a root password, remove anonymous users, and enhance overall security.

Run the interactive script:

sudo mysql_secure_installation

Follow the on-screen prompts carefully. It is highly recommended to set a strong root password and answer “Y” (yes) to all the security questions.

Step 4: Add the Icinga Repository

To ensure we get the latest stable version of Icinga, we need to add the official Icinga package repository to our system.

First, add the Icinga GPG key to your system’s trusted keys:

wget -O - https://packages.icinga.com/icinga.key | sudo apt-key add -

Next, create a new repository source file for Icinga:

sudo nano /etc/apt/sources.list.d/icinga.list

Add the following line to the file, then save and exit (Ctrl+X, Y, Enter):

deb https://packages.icinga.com/debian icinga-buster main

Finally, update your package list again to include the new Icinga repository:

sudo apt update

Step 5: Install Icinga 2 and Monitoring Plugins

With the repository configured, we can now install the core Icinga 2 engine and the standard set of monitoring plugins. These plugins are the scripts that perform the actual checks on your hosts and services (e.g., checking CPU load, disk space, or HTTP connectivity).

sudo apt install -y icinga2 monitoring-plugins

After the installation, enable and start the Icinga 2 service:

sudo systemctl enable icinga2
sudo systemctl start icinga2

Step 6: Enable the Icinga 2 API

Icinga Web 2 communicates with the Icinga 2 core through its API. We need to enable and configure this feature. The icinga2 command has a helpful setup utility for this.

Run the following command:

sudo icinga2 api setup

This command will automatically enable the api feature, create the necessary certificates, and generate a default API user named root with a generated password in the conf.d/api-users.conf file. Restart the Icinga 2 service to apply the changes.

sudo systemctl restart icinga2

Step 7: Install Icinga Web 2

Now it’s time to install the web interface itself, along with the command-line interface (CLI) tool used for configuration and setup.

sudo apt install -y icingaweb2 icingacli

Step 8: Create the Database for Icinga Web 2

Icinga Web 2 requires its own database to store user and configuration data. We will create a database and a dedicated user for it in MariaDB.

Log into the MariaDB shell using the root password you set earlier:

sudo mysql -u root -p

Execute the following SQL commands. Be sure to replace 'your_strong_password' with a secure password of your own.

CREATE DATABASE icingaweb2;
CREATE USER 'icingaweb2'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON icingaweb2.* TO 'icingaweb2'@'localhost';
FLUSH PRIVILEGES;
EXIT;

This creates the database, the user, and grants that user full control over the new database.

Step 9: Use the Icinga Web 2 Setup Wizard

The final step is to complete the installation using the web-based setup wizard. First, we need to generate a setup token from the command line.

sudo icingacli setup token create

Copy the token that is displayed. Now, open your web browser and navigate to:

http://your_server_ip/icingaweb2/setup

You will be guided through the following steps:

  1. Welcome Page: Paste the setup token you just created.
  2. Modules: Select the modules you wish to enable. The Monitoring module is essential.
  3. Environment Checks: The wizard will check for all required PHP extensions and directory permissions. If everything was installed correctly, all checks should pass.
  4. Database Configuration: Select “Database” as the resource type. Enter the database details you created in Step 8:
    • Database Name: icingaweb2
    • Username: icingaweb2
    • Password: your_strong_password
  5. Authentication Backend: Choose a name for your authentication backend (e.g., icingaweb_auth) and select “Database” as the backend type. The wizard will use the same database resource you just configured.
  6. Create Admin Account: Set up your primary administrator account. Choose a strong password and make a note of it.
  7. Monitoring Backend: Configure how Icinga Web 2 connects to the Icinga 2 core. Choose “IDOMySQL” as the backend type. You will need to import a schema into your Icinga 2 database (not the Icinga Web 2 database). Follow the on-screen command, which will look similar to this:
    sudo mysql -u root -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
  8. Monitoring Instance: Provide the database credentials for the Icinga 2 IDO database.
  9. Review: A final page will show you a summary of all your configuration choices. If everything looks correct, click “Finish”.

Final Steps and Security

Congratulations! You have successfully installed Icinga 2 and Icinga Web 2. You can now log in at http://your_server_ip/icingaweb2 using the administrator account you created during the setup.

Important Security Tip: For security, it is critical to remove the public setup wizard after installation. You can do this by deleting the setup token:

sudo icingacli setup token delete

You now have a fully functional monitoring server ready to be configured. Your next steps will be to start adding hosts and services to monitor, which can be done directly through configuration files or by installing the powerful Icinga Director module for a fully web-based configuration experience.

Source: https://kifarunix.com/install-icinga-web-2-on-debian-10-buster/

900*80 ad

      1080*80 ad