How to compile and install Nagios on RHEL 8
nomorespice edited this page May 27, 2022
·
3 revisions
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:
- you installed the RHEL 8 x64 Operating System according to How to install RHEL 8 via kickstart
- you installed the Apache Web Service according to How to install APACHE Web Server on RHEL 8
- you are performing these tasks as root
- you are performing these tasks in order, as some tasks require others to be completed first
mkdir /var/src
dnf -y install gd-devel zip
useradd nagios
passwd -l nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
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
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/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
/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
systemctl restart httpd
systemctl --now enable nagios