Title: Install Nagios
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Install Nagios

Nagios can be installed from rpm files available from the epel repository, but it is often desirable to install it from source.  This will give more control over the options and will ensure that the installation matches common installations, which is helpful when reconfiguring based on advice from the Internet.

Start by ensuring the requirements are installed and the user is created on a Red Hat derivative server.  Since the backuppc program reconfigures httpd, plan to install Nagios on a server without the backuppc web application.

yum -y install httpd mod_ssl php glibc gd gd-devel openssl-devel gcc
useradd -c "nagios service" -m nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

Install a certificate and ensure that encryption is working correctly for https connections.

Next, download the latest stable version of Nagios Core and the Nagios Plug-Ins from http://www.nagios.org/download/.

Extract the files, compile the source code, install and configure Nagios Core.

cd /usr/local/src
tar xvf ~/Downloads/nagios-4*z
cd nagios-4*[!z]
./configure -with command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
make install-exfoliation
sed -i 's/^# SSL/SSL/' /etc/httpd/conf.d/nagios.conf
sed -i 'slmain.phplcgi-bin/tac/cgil'
/usr/local/nagios/share/index.php
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
In -s /usr/local/nagios/etc/etc/nagios
echo "nagios:        root">> /etc/aliases; newaliases
echo "RedirectMatch permanet ^/+$ https://clark.carltm.com/nagios/" >> \
/etc/httpd/conf.d/welcome.conf
chkconfig httpd pn
service httpd restart

Extract the files, compile the source code, install and configure Nagios Plug-Ins.

cd /usr/local/src
tar xvf ~/Downloads/nagios-p*z
cd nagios-p*[!z]
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
make install-root
chown nagios.apache /usr/local/nagios/bin/nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
chkconfig --add nagios
chkconfig nagios on
service nagios start

Nagios can now be accessed by connecting to https://<servername>/nagios. Use the password created for the nagiosadmin account during the installation.