2022 TUTORIAL: 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 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

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

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.

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.
