How to compile and install Nagios on RHEL 8 - nomorespice/rhel8-howto GitHub Wiki

Nagios is a free and open-source computer-software application that monitors systems, networks and infrastructure. Nagios provides monitoring and alerting services for servers, switches, applications and services. This procedure will guide you through the installation process on a Red Hat Enterprise Linux 8 server.

This document assumes that:

Install required software

mkdir /var/src
dnf -y install gd-devel zip

Create and configure the required user and groups

useradd nagios
passwd -l nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

Download, compile and install the Nagios service

cd /var/src
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.7.tar.gz -O nagios-4.4.7.tar.gz
tar xzf nagios-4.4.7.tar.gz
cd nagios-4.4.7
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-daemoninit
make install-config
make install-commandmode
make install-exfoliation
make install-webconf

cd /var/src
wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz -O nagios-plugins-2.3.3.tar.gz
tar xzf nagios-plugins-2.3.3.tar.gz
cd nagios-plugins-2.3.3
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Create a web access username and password

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Re-enable required auth modules

/bin/sed -i 's/#LoadModule authn_core_module/LoadModule authn_core_module/g' /etc/httpd/conf.modules.d/00-base.conf
/bin/sed -i 's/#LoadModule authn_file_module/LoadModule authn_file_module/g' /etc/httpd/conf.modules.d/00-base.conf

Configure SELinux

/bin/cat << EOT >/var/src/my-cmdcgi.te
module my-cmdcgi 1.0;

require {
	type httpd_sys_script_t;
	type usr_t;
	class fifo_file { getattr open write };
}
allow httpd_sys_script_t usr_t:fifo_file { getattr open write };
EOT

checkmodule -M -m -o /var/src/my-cmdcgi.mod /var/src/my-cmdcgi.te
semodule_package -o /var/src/my-cmdcgi.pp -m /var/src/my-cmdcgi.mod
semodule -i /var/src/my-cmdcgi.pp

Start and enable required services

systemctl restart httpd
systemctl --now enable nagios
⚠️ **GitHub.com Fallback** ⚠️