MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Icinga: How to Install Icinga 2 on Ubuntu

Prerequisites

  • A server with Ubuntu 22.04 as OS
  • User privileges: root or non-root user with sudo privileges

Step 1. Update the System

Before we start to install the software, we need to update the system packages to the latest versions available.

$ sudo apt-get update -y && sudo apt-get upgrade -y

Step 2. Install LAMP stack

First of the LAMP stack is the Apache Web server. To install it execute the following command:

$ sudo apt install apache2 -y

Once installed, start and enable the service.

$ sudo systemctl enable apache2 && sudo systemctl start apache2

Check if the service is up and running:

$ sudo systemctl status apache2

You should receive the following output:

root@host:~# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-04-22 18:00:43 CDT; 17min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 792 (apache2)
      Tasks: 7 (limit: 4571)
     Memory: 22.5M
        CPU: 246ms
     CGroup: /system.slice/apache2.service

Next is PHP, along with its extensions. To install the PHP8.1 along with extensions, execute the following command:

$ sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl libapache2-mod-php$ sudo apt install imagemagick

The last of the LAMP stack is the MariaDB database server. To install it execute the command below.

$ sudo apt install mariadb-server -y

Start and enable the mariadb.service with the following commands:

$ sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the mariadb.service

$ sudo systemctl status mariadb

You should receive the following output:

root@host:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-04-22 18:19:53 CDT; 9s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 5829 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 16 (limit: 4571)
     Memory: 61.4M
        CPU: 514ms
     CGroup: /system.slice/mariadb.service
             └─5829 /usr/sbin/mariadbd

Change the mariadb password

For securing the database, you should use sudo again.

$ sudo mysql_secure_installation
Mysql_secure_installation output: root password changed, anonymous users and test database removed


Step 3. Install Icinga 2

First, we will add the GPG key, and will create a repository:

REFERENCE – https://icinga.com/docs/icinga-2/latest/doc/02-installation/02-Ubuntu/

wget -O - https://packages.icinga.com/icinga.key | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpg

. /etc/os-release; if [ ! -z ${UBUNTU_CODENAME+x} ]; then DIST="${UBUNTU_CODENAME}"; else DIST="$(lsb_release -c| awk '{print $2}')"; fi; \
 echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/ubuntu icinga-${DIST} main" > \
 /etc/apt/sources.list.d/${DIST}-icinga.list
 echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/ubuntu icinga-${DIST} main" >> \
 /etc/apt/sources.list.d/${DIST}-icinga.list

Update the system and install Icinga2

$ sudo apt update -y$ sudo apt install icinga2 -y

After installation, start and enable the icinga2 service.

$ sudo systemctl start icinga2 && sudo systemctl enable icinga2

Check the status of Icinga 2:

$ sudo systemctl status icinga2

You should get the following output:

root@host:~# sudo systemctl status icinga2
● icinga2.service - Icinga host/service/network monitoring system
     Loaded: loaded (/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/icinga2.service.d
             └─limits.conf
     Active: active (running) since Sat 2023-04-22 19:06:11 CDT; 4min 35s ago
   Main PID: 11632 (icinga2)
     Status: "Startup finished."
      Tasks: 16
     Memory: 14.3M
        CPU: 435ms
     CGroup: /system.slice/icinga2.service

Step 4. Install the Icinga2 IDO Module

To install the Icinga2 IDO module, execute the following command:

$ sudo apt install icinga2-ido-mysql -y

While installing, choose Yes on both windows. It is about Icinga2 using MySQL.

After this, we need to create an icinga2-ido-mysql database with the following commands:

$ mysql -u root -p

CREATE DATABASE icinga_ido_db;
GRANT ALL ON icinga_ido_db.* TO 'icinga_ido_db'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
FLUSH PRIVILEGES;
EXIT;

Once the database is created, import the Icinga2 IDO schema with the following command:

$ sudo mysql -u root -p icinga_ido_db < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Once the schema is imported, the next is to enable the Icinga2 IDO module:

$ vi  /etc/icinga2/features-available/ido-mysql.conf

Paste the following lines of code:

/** * The db_ido_mysql library implements IDO functionality * for MySQL. */library "db_ido_mysql"object IdoMysqlConnection "ido-mysql" {  user = "icinga_ido_db",  password = "rajesh123",  host = "127.0.0.1",  database = "icinga_ido_db"}

Save the file, close it and enable the Icinga2-ido-mysql with the following command:

$ sudo icinga2 feature enable ido-mysql

After this restart the Icinga2 service:

$ systemctl restart icinga2

Step 5. Install and Setup IcingaWeb2

To install Icinga Web execute the following commands:

sudo apt install icingaweb2 icingacli -y

Next is to create a second database for the Icinga web:

$ mysql -u root -p

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

Next, we need to create an Icinga token:

root@host:~# sudo icingacli setup token create
The newly generated setup token is: dd3a1a8b218be0db

That was all with installing Icinga via the command line. The last step is about finishing the Icinga installation.

Step 6. Finish Icinga Installation

To finish the Icinga installation, you need to access it at http://YourServerIPaddress/icingaweb2/setup.

GitLab Web hooks settings with a Jenkins build_now URL triggered on push events

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Install and Configure Gerrit on CentOS and Ubuntu (MySQL + Apache Reverse Proxy)

A practical, step-by-step guide to installing Gerrit for code review on CentOS/RHEL and Ubuntu/Debian. Includes package command comparisons, setup workflow, Apache proxy configuration, and verification checks.

Read More

Datadog Log: Lab and Assignment

Lab Manual: Datadog Logs Search, Filter, Sorting, Display, and Analysis Hands-on Datadog Logs Explorer Lab using Ubuntu Linux Logs and Apache Logs Lab Objective By the end…

Read More

Managing MariaDB Root Password and Connection Behavior in XAMPP (Ubuntu)

☁️ Introduction When working with MariaDB/MySQL inside XAMPP on Ubuntu, many developers face confusing issues related to root password behavior, localhost vs 127.0.0.1 access, and authentication plugins.This…

Read More

icinga tutorials: How to monitor Apache2 using icinga agent

To monitor Apache2 on an Ubuntu server where Icinga agent is installed, while Icinga server is installed on another Ubuntu server, you can follow these step-by-step instructions….

Read More

List of Compreshive Checklist to do Security Audit in XAMPP server

Conducting a security audit on a XAMPP server is crucial, especially if you’re considering moving a local development environment to a production setting. XAMPP is primarily designed…

Read More

Newrelic Tutorials: How to Integrate Apache2 in ubuntu

Config file Confirmation Confrimation Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x