Oracle Linux 7.9 + Icinga2 + Icinga Web 2 install

Icinga2 + Icinga Web 2 install Oracle Linux 7.9

As Oracle Linux is not found on ICINGAs official Compatibility List

Requirements

Author: @David Okon
Revision: v0.1

Tested with:

  • Icinga 2 v2.12.1-1
  • Icinga Web 2 v2.8.2

Linux

[root@localhost ~]# cat /etc/os-release && uname -r
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Oracle Linux Server 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.9
5.4.17-2036.100.6.1.el7uek.x86_64

Installation

OS Updates & enabled repositories

[root@localhost ~]# cat /etc/yum.repos.d/oracle-epel-ol7.repo 
[ol7_developer_EPEL]
name=Oracle Linux $releasever EPEL Packages for Development ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer_EPEL/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[root@localhost ~]# cat /etc/yum.repos.d/oraclelinux-developer-ol7.repo 
[ol7_developer]
name=Oracle Linux $releasever Development Packages ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_developer_kvm_utils]
name=Oracle Linux $releasever KVM Utilities for Development and test ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer/kvm/utils/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_developer_UEKR5]
name=Oracle Linux $releasever Unbreakable Enterprise Kernel Release 5  Packages for Development and test ($basearch)
baseurl=http://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer_UEKR5/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_developer_UEKR6]
name=Developer Preview of UEK Release 6 ($basearch)
baseurl=http://yum$ociregion.oracle.com/repo/OracleLinux/OL7/developer/UEKR6/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[root@localhost ~]# cat /etc/yum.repos.d/oracle-linux-ol7.repo 
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_u0_base]
name=Oracle Linux $releasever GA installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/0/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u1_base]
name=Oracle Linux $releasever Update 1 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/1/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u2_base]
name=Oracle Linux $releasever Update 2 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/2/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u3_base]
name=Oracle Linux $releasever Update 3 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/3/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u4_base]
name=Oracle Linux $releasever Update 4 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/4/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u5_base]
name=Oracle Linux $releasever Update 5 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/5/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u6_base]
name=Oracle Linux $releasever Update 6 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/6/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u7_base]
name=Oracle Linux $releasever Update 7 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/7/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u8_base]
name=Oracle Linux $releasever Update 8 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/8/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_u9_base]
name=Oracle Linux $releasever Update 9 installation media copy ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/9/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_MODRHCK]
name=Latest RHCK with fixes from Oracle for Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/MODRHCK/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0

[ol7_latest_archive]
name=Oracle Linux $releasever Latest ($basearch) - Archive 
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/latest/archive/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_optional_archive]
name=Oracle Linux $releasever Optional ($basearch) - Archive
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/optional/archive/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_security_validation]
name=Oracle Linux $releasever ($basearch) Security Validations
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/security/validation/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_ociyum_config]
name=OCI specific release packages Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/oci/included/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[root@localhost ~]# cat /etc/yum.repos.d/oracle-softwarecollection-ol7.repo
[ol7_software_collections]
name=Software Collection Library release 3.0 packages for Oracle Linux 7 ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/SoftwareCollections/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[root@localhost ~]# cat /etc/yum.repos.d/uek-ol7.repo 
[ol7_UEKR6]
name=Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR6/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_UEKR5]
name=Latest Unbreakable Enterprise Kernel Release 5 for Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR5/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR3]
name=Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR3_OFED20]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel on Oracle Linux 7 ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR3_OFED20/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20

[ol7_UEKR6_RDMA]
name=Oracle Linux 7 UEK6 RDMA ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR6/RDMA/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR5_RDMA]
name=Oracle Linux 7 UEK5 RDMA ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR5/RDMA/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR4_OFED]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel Release 4 on Oracle Linux 7 ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR4/OFED/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20

[ol7_UEKR4_archive]
name=Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch) - Archive
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR4/archive/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[ol7_UEKR5_archive]
name=Unbreakable Enterprise Kernel Release 5 for Oracle Linux $releasever ($basearch) - Archive
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/UEKR5/archive/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[root@localhost ~]# cat /etc/yum.repos.d/virt-ol7.repo 
[ol7_kvm_utils]
name=Oracle Linux $releasever KVM Utilities ($basearch)
baseurl=https://yum$ociregion.oracle.com/repo/OracleLinux/OL7/kvm/utils/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

Just to be on the safe side we install for the purpose of missing dependencies packages the ‘centos-release-scl’ package. This is just a fail safe if the ol7 scl doesn’t provide the needed package.

The usual repository steps:

[root@localhost ~]# yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm

As we install a monitoring system we need checks to check with our fresh installed monitoring system something

[root@localhost ~]# yum install nagios-plugins-all -y

As a database backend i default also simply to mariadb-server here … as you can later change the IDO as you like just for the purpose of the ‘how to’ i choose this.

[root@localhost ~]# yum install mariadb-server -y

And finally all the icinga2 components we need.

[root@localhost ~]# yum install icinga2 -y
[root@localhost ~]# yum install icingaweb2 -y
[root@localhost ~]# yum install icinga2-ido-mysql -y

Webserver

Also here the ususal culprit (Apache2) not fancy but always in the repositories.

[root@localhost ~]# yum install httpd -y

And the php-fpm package:

I defaulted here to the rh-php73-php-fpm package because even the ol7 scl collection pulls it.

[root@localhost ~]# yum install rh-php73-php-fpm -y

Small adjustment in the php.ini

[root@localhost ~]# vi /etc/opt/rh/rh-php73/php.ini

date.timezone = 'europe/berlin' //otherwise it isn't set 

Configuration

Now we start with the configuration of some of the components

Let us start with the Database:

[root@localhost ~]# systemctl enable mariadb.service --now
[root@localhost ~]# mysql_secure_installation

Advice please set a responsible root pw for the mariadb.

[root@localhost ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

For ease of use purpose a .my.cnf file

[root@localhost ~]# vi .my.cnf

Content:

[client]
user=root
password=mysecretpassword

Now we finally create the databases:

[root@localhost ~]# mysql -e "create database icinga2;"
[root@localhost ~]# mysql -e "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga2.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';"

We push the IDO schema into the Database

[root@localhost ~]# mysql icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql

After filling the schema into the database we need to adjust the icinga2 feature config

[root@localhost ~]# vi /etc/icinga2/features-available/ido-mysql.conf 

changed to:

/**
 * The IdoMysqlConnection type implements MySQL support
 * for DB IDO.
 */

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "icinga"
  host = "localhost"
  database = "icinga2"
}     

Set SELinux to permissive:

[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i 's/=enforcing/=permissive/g' /etc/selinux/config 

Before we go into the web2 setup via the browser we enable & start the following services

[root@localhost ~]# systemctl enable httpd --now
[root@localhost ~]# systemctl enable rh-php73-php-fpm --now
[root@localhost ~]# systemctl enable mariadb --now
[root@localhost ~]# systemctl enable icinga2 --now

We enable some icinga2 features before we enter the websetup

[root@localhost ~]# icinga2 feature enable ido-mysql command
Enabling feature ido-mysql. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature command. Make sure to restart Icinga 2 for these changes to take effect.
[root@localhost ~]# systemctl restart icinga2

And finally that we can enter the Web 2 setup:

[root@localhost ~]# icingacli setup token create
The newly generated setup token is: af2593c41ff30f36

Web 2 Steps

Step 1

Step 2

Step 3

Step 4

Step 5

Step 6

Step 7

Step 8

Step 9

Step 10

Step 11

Step 12

Step 13

Step 14

Step 15

Step 16

Conclusion

At this point you have a basic Icinga 2 + Icinga Web 2 + Icinga 2 IDO on a Oracle Linux 7.9 running.

FAQ

ToDo if anyone asks something specific :slight_smile:

1 Like