BILLYSOFTACADEMY

2022 TUTORIAL: LEARN HOW TO INSTALL ICINGA2 ON LINUX UBUNTU 20.04 LTS IN THE CLOUD ON AWS

ICINGA2 is a free and open source computer system and network monitoring application. It was originally created as a fork of the Nagios system monitoring application in 2009. With ICINGA2 you are not only limited to monitoring one computer but you can actually monitor you entire IT infrastructure so as to stay on top of things and anticipate problems as and when they happen. With ICINGA2 you can also monitor automation workloads as well as workloads deployed in the cloud on platforms such as AWS. You can also Collect and analyse data from your whole IT infrastructure, improve business results and drive value creation forward. You can also build custom views by filtering and grouping elements. Store them in dashboards, Get notified and proactively react to errors before they become problems and a lot more. Watch this video to learn how to install ICINGA2 on LINUX UBUNTU 20.04 LTS in the cloud on AWS.

Requirements

In order to complete this tutorial, the following is a list of items that may be needed or required. Please ensure to have these items available before taking implementation action on the tutorial to ensure success:
1) An amazon web services account or any user account on any other cloud VPS hosting provider
2) A Linux Ubuntu 20.04  LTS instance
3) An SSH client such as putty or the built-in macOS / Linux terminal app
4) The LAMP stack
5) The icinga2 web app installation files

Overview

1) Sign in to your AWS account or cloud VPS account and create a Linux Ubuntu 20.04 LTS instance
2) Connect to the instance via SSH and install package updates
3) Configure a custom hostname and restart the instance
4) Install the LAMP stack and the icinga2 web application
5) Open a new browser window and complete the post-installation setup.

Step 1: Sign in to your AWS account or cloud VPS account and create a Linux Ubuntu 20.04 LTS instance

The first step is to sign into your amazon account and open the Lightsail VPS hosting service. You can use the EC2 service however the Lightsail service is a bit simpler to use for this setup. If you do not have an AWS account, click HERE to sign up for a free tier account. Alternatively, you can use any other cloud VPS provider and skip to step 3. 

On the Lightsail dashboard, click on the create instance button to open the instance, creation wizard.

On the Select a platform section click Linux. / Unix and on the Select a blueprint section click the Os Only button. Select the Linux Ubuntu 20.04 LTS blueprint and scroll down to the Choose your instance plan section. We recommend that you select the $10 plan. Type in a name for your instance on the Identify your instance field and click Create instance

We recommend that you set a static IP address on your instance. If you are using AWS Lightsail, click on the Networking tab and click Create static IP. Choose the instance that you have created and type in a name for the instance on the Identify your IP field. Click Create static IP to complete the elastic IP address creation process.  

Step 2: Connect to the instance via SSH and install updates.

Click on the instance that you have created. On the Connect tab, scroll down and click Download default key. If you are using a Windows PC, click HERE to learn how to connect. If you are using a Mac or Linux-based pc, open your terminal application and run the following commands:

Next, run the following commands to set a custom hostname and to install system and package updates:

Press CONTROL + O, press ENTER and press CONTROL + X to exit out of the file

Step 3: Install the LAMP stack and the Icinga web app

The next step is to install the LAMP stack and the Icinga web app. Reconnect to the icinga server using your SSH client and run the following commands. These will install Apache, PHP, the MariaDB database engine as well as PHP extensions needed by icinga.

The systemctl status {apache2,mariadb} command will show the status of the services as Active (running)

Run the following command to run the MySQL secure installation script. Below are some questions that the script will ask as well as responses that you can provide

Enter current password for root (enter for none: (Press Enter on your keyboard)
Set root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it ? [Y/n] Y

You also need to make changes to the php.ini configuration file. The changes that you need to make are as follows:
memory_limit = 256M
post_max_size = 64M
upload_max_filesize = 100M
max_execution_time = 300
default_charset = “UTF-8”
date.timezone = “Asia/Kolkata”
cgi.fix_pathinfo=0

Copy and paste into your terminal the command below:

Once you have applied the changes, run the command below to restart apache

Copy and paste the commands below to add the Icinga repository to your ubuntu server and to install Icinga using the apt package manager:

Start the icinga system service and configure it to start automatically at system reboot.

Step 4: Create a database for Icinga2

The next step is to create a database for Icinga2. This is done on the MariaDB database monitor. Run the following commands to create the database:

Initialize the icinga2 database scheme and configure the database settings in the icinga ido-mysql.conf file:

Copy and paste the commands below, to install the Icinga2 web based dashboard. 

Step 5: Create a second database for the Icinga2 Web Dashboard.

The Icinga2 web dashboard requires a database to save all dashboard related information. Reconect to the MariaDB database shell and run the following commands to create a second database for the Icinga2 web dashboard.

Next, run the following command to generate an icinag2 setup token

Incase if you forget the setup token, you can retrieve it by running the command:

To complete the installation, open a new web browser window and type in the URL to access the ICINGA2 web dashboard i.e http://server-ip/icingaweb2/setup. Complete the post-installation setup and once you are done with that, you can start using Icinga2 network monitoring features to monitor your network.