LinuxTutorialsUbuntu

How To Install Icinga on Ubuntu 20.04 LTS

Install Icinga on Ubuntu 20.04

In this tutorial, we will show you how to install Icinga on Ubuntu 20.04 LTS. For those of you who didn’t know, Icinga 2 is an open-source network monitoring system that checks the availability of your network resources, notifies users of outages, and generates performance data for reporting. It’s Scalable and extensible, Icinga2 can monitor large, complex environments across multiple locations.

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 through the step-by-step installation of Icinga 2 on an Ubuntu 20.04 Focal Fossa. You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Icinga on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Install LAMP stack.

An Ubuntu 20.04 LAMP server is required. If you do not have a LAMP installed, you can follow our guide here.

Step 3. Installing Icinga on Ubuntu 20.04.

Now we install the icinga2 packages and Nagios Monitoring plugins. First, add the GPG key of the Icinga2 to your system:

curl https://packages.icinga.com/icinga.key | apt-key add -

Next, create a new repository file ‘icinga-focal.list‘:

cd /etc/apt/sources.list.d/
nano icinga-focal.list

Add the following repository configuration:

deb http://packages.icinga.com/ubuntu icinga-focal main
deb-src http://packages.icinga.com/ubuntu icinga-focal main

Then, run an update of the package list and install Icinga packages:

sudo apt update
sudo apt install icinga2 monitoring-plugins

Once the installation is completed, start the Icinga2 service and add it to the system boot:

sudo systemctl start icinga2
sudo systemctl enable icinga2

Step 4. Configure the Database Server.

We will install the icinga2 module for the MySQL support named ‘icinga2-ido-mysql‘.

sudo apt install icinga2-ido-mysql

Next, to make the Icinga works with the new MySQL/MariaDB version, we will configure the MySQL user ‘icinga2’ with the MySQL native password authentication:

mysql -u root -p

After that, change the authentication of user ‘icinga2@localhost’ with the native MySQL authentication plugin using the following query:

ALTER USER icinga2@localhost IDENTIFIED WITH mysql_native_password BY 'your-strong-passwd';
flush privileges;

Next, enable the ‘ido-mysql‘ feature and check all enabled plugins:

icinga2 feature enable ido-mysql
icinga2 feature list

Then restart Icinga for the changes to take effect:

sudo systemctl restart icinga2

Step 5. Installing the Icinga Web.

Icinga Web 2 is a powerful PHP framework that provides a web management interface for Icinga. Now we Install icingaweb2 and icingacli packages using the following command:

sudo apt install icingaweb2 icingacli

Next, generate the icingaweb2 token for the installation:

icingacli setup token create

You’ll see a similar output:

icingacli setup token create
The newly generated setup token is: e00b7kimpoi690722

Next, log in to the MySQL shell using the MySQL command below:

mysql -u root -p

Create a new database and user using the following queries:

create database icingaweb2;
create user icingaweb2@localhost identified with mysql_native_password by "your-strong-passwd";
grant all privileges on icingaweb2.* to icingaweb2@localhost with grant option;
flush privileges;

Step 6. Accessing Icinga 2 Web Interface.

Icinga2 will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com/icingaweb2/setup or http://server-ip-address/icingaweb2/setup and complete the required steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Install Icinga on Ubuntu 20.04

Congratulations! You have successfully installed Icinga. Thanks for using this tutorial for installing Icinga 2 on your Ubuntu 18.04 LTS system. For additional help or useful information, we recommend you to check the official Icinga website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button