How to Install Nagios 4.0.6 on CentOS 6.3

Install the prerequisite packages

yum install gd gd-devel httpd php gcc glibc glibc-common make perl

Create the Nagios user.

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

Create a directory to download and build Nagios from

mkdir /root/nagios
cd /root/nagios

Download Nagios and the Nagios plugins

wget downloads.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.6/nagios-4.0.6.tar.gz
wget nagios-plugins.org/download/nagios-plugins-2.0.2.tar.gz 

Extract the Nagios zip

 tar xvzf nagios-4.0.6.tar.gz
cd nagios-4.0.6

Compile and make it

./configure
make all
make install-init
make install-commandmode
make install-config
make install-webconf

Create a password so you can login to the web interface

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

Enable Nagios on startup

 chkconfig nagios on

Start the service

service nagios start

Install the plugins.

cd ..
tar xvzf nagios-plugins-2.0.2.tar.gz
cd nagios-plugins-2.0.2
./configure
make
make install

Start apache and make sure it starts on boot.

service httpd start
chkconfig httpd on

 

Leave a Reply

Your email address will not be published. Required fields are marked *