Install Nagios Infrastrucure Monitoring

Below are the commands used to install Nagios infrastructure monitoring sofware on Ubuntu.
Install Nagios prerequisites
# sudo apt install build-essential wget unzip perl postfix
# sudo apt install apache2 php php-gd openssl libapache2-mod-php libgd-dev openssl libssl-dev
# apt install gcc
# mkdir nagiosinstall
# cd nagiosinstall
Install Nagios files
# wget https://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.4.6/nagios-4.4.6.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
Add users
# sudo useradd nagios
# sudo groupadd nagcmd
# sudo usermod -a -G nagcmd nagios
# sudo usermod -a -G nagcmd,nagios www-data
Extract the files
# tar zxvf nagios-4.4.6.tar.gz
# tar zxvf nagios-plugins-2.3.3.tar.gz
Extract, Compile and Install
# cd nagios-4.4.6/
# sudo ./configure –with-command-group=nagcmd –with-httpd-conf=/etc/apache2/sites-available –prefix=/usr/local/nagios –sysconfdir=/etc/nagios
# sudo make all
# sudo make install
# sudo make install-init
# sudo make install-config
# sudo make install-commandmode
# sudo make install-webconf
# sudo cp -R contrib/eventhandlers/ /usr/local/nagios/libexec
# sudo chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
# sudo a2ensite nagios
# sudo a2enmod rewrite cgi
Reset the system
# sudo systemctl daemon-reload
# sudo systemctl start apache2
# sudo systemctl start nagios
# sudo systemctl enable apache2
# sudo systemctl enable nagios
Enable access
# sudo htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
New password:********
Re-type new password:********
Restart services
# sudo systemctl restart apache2
# sudo systemctl restart nagios
Plugins
# cd ..
# cd nagios-plugins-2.3.3
# sudo ./configure –with-nagios-user=nagios –with-nagios-group=nagios
# sudo make
# sudo make install
Try the local web address
http://localhost/nagios/
Login:nagiosadmin
Password:********
Nagios config file (nagios.cfg)
# sudo find -name nagios.cfg
./etc/nagios/nagios.cfg
log_file=/usr/local/nagios/var/nagios.log