In this tutorial, we will show you how to install Icinga on AlmaLinux 8. For those of you who didn’t know, Icinga 2 is an open-source tool used for the monitoring of network resources, managing alerts and providing you assistance in order to monitor your network.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Icinga monitoring on AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Icinga on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing Icinga on AlmaLinux 8.
Now we add the Icinga repository to your system:
sudo tee /etc/yum.repos.d/icinga2.repo<<EOF [icinga2] name=Icinga 2 Repository for EPEL 8 baseurl=https://packages.icinga.com/epel/8/release enabled=1 EOF
Next, import the Icinga GPG key:
sudo rpm --import https://packages.icinga.com/icinga.key
After that, update dnf
cache:
sudo dnf clean all sudo dnf makecache
Once the repository has been added, we can now install Icinga 2 by using dnf
command:
sudo dnf install vim icinga2 icinga2-selinux icinga2-ido-mysql vim-icinga2
Next, enable Icinga 2 modules:
sudo icinga2 feature enable command ido-mysql syslog
Step 3. Installing MariaDB.
MariaDB is a popular database server. Now we install the MariaDB database server with the following command below:
sudo dnf install mariadb-server mariadb
Once the installation is complete, start to enable it to start on system start-up using:
sudo systemctl restart mariadb sudo systemctl status mariadb sudo systemctl enable mariadb
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - 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
Create a MariaDB database for Icinga 2 as follows:
$ mysql -u root -p CREATE DATABASE icinga; GRANT ALL PRIVILEGES ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'your-strong-passwd'; FLUSH PRIVILEGES; EXIT;
Next, we import Icinga 2 database:
mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Then, configure database access:
sudo nano /etc/icinga2/features-available/ido-mysql.conf
Add the following lines:
/** * The IdoMysqlConnection type implements MySQL support * for DB IDO. */ object IdoMysqlConnection "ido-mysql" { user = "icinga" password = "your-strong-passwd" host = "localhost" database = "icinga" }
Save and close, then start and enable Icinga 2:
systemctl enable --now icinga2
Verify the status of the Icinga 2 service:
systemctl status icinga2.service
Congratulations! You have successfully installed Icinga. Thanks for using this tutorial for installing the Icinga monitoring server on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Icinga website.