Today we are going to learn that how to Install Icinga 2 on Ubuntu 20.04. Before going to the installation process let’s have a short introduction about it. Icinga 2 is an open source tool used for the monitoring of network resources, manage alerts and provide you the assistance in order to monitor your network. To install Icinga 2 on Ubuntu 20.04, simply follow the below steps for an easy and optimal installation.
Step 1: Update Your System
As usual we do, first of all update your system to the latest packages by hitting the below command.
sudo apt -y update && sudo apt -y upgrade
Wait for it to finish the updates and then move to the next step.
Step 2: Adding Icinga 2 Repository on Ubuntu 20.04
To add the icinga 2 repository on Ubuntu 20.04, make sure to be the root user or switch it by
sudo su -
Also make sure to get the https and curl packages if they are not already installed.
apt-get install -y apt-transport-https curl
Then run the given command to add the Icinga public signing key
curl https://packages.icinga.com/icinga.key | apt-key add -
After it fire the below command to add the Icinga repository on Ubuntu 20.04.
echo "deb http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/icinga2.list
echo "deb-src http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/icinga2.list
Step 3: Installing Icinga 2 on Ubuntu 20.04
Now, it’s time to install the Icinga 2 on our system. So, install it by simply typing the below command in your terminal.
apt-get install -y icinga2
After it start the icinga services by hitting the following command.
systemctl start icinga2
To start the services on the boot of system, run the below command.
systemctl enable icinga2
Step 4: Make Database for Icinga 2
As to process the information and the configuration import, export Icinga 2 will require a database. Install the database by running the below command if you’ve not already installed it.
apt-get install -y mariadb-server mariadb-client
After it hit the command given below to install the IDO modules for MySQL.
apt-get install -y icinga2-ido-mysql
As the installation started you’ll be required to configure it. Complete the configuration as mentioned below.
In the first step hit NO (Enable Icinga 2’s ido-mysql feature?).
On the second step select NO(Configure Database for Icinga2-ido-mysql with dbconfig-common). As we’ll setup DB for IDO manually.
Now, login to the root user.
mysql -u root -p
Then create a new Database for Icinga 2.
MariaDB [(none)]> CREATE DATABASE icinga2; Query OK, 1 row affected (0.002 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON icinga2.* to [email protected] identified by "icinga123"; Query OK, 0 rows affected (0.004 sec) MariaDB [(none)]> quit; Bye
Finally run the following command to import the Icinga 2 IDO schema.
mysql -u root -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Step 5: Enable & Configure the IDO MySQL Module
Now, enable the ido-mysql feature as well as the command feature by typing the below commands.
icinga2 feature enable ido-mysql
icinga2 feature enable command
After enabling the IDO modules, place the new config file at /etc/icinga2/features-enabled/ido-mysql.conf.
Edit it and update it to match the below data.
user = “icinga2”,
password = “icinga123”,
host = “localhost”,
database = “icinga2”
Then restart the Icinga 2 services to take effects of new changes.
systemctl restart icinga2
So, this is how you can install Icinga 2 on Ubuntu 20.04. In our next guide we’ll move forward to setup the Icinga 2 web interface.