In this series of posts im going to gro through the steps to install and configure Nagios 4.0 On Centos 6.4, so it can be used to monitor server and network equipment on a network. I will be using Centos 6.4 64bit to install and configure Nagios. i will assume you have a clean centos installation on your pc/server.
Requirments for nagios:
Required packages are:
httpd, php, gcc, glibc, glibc-common, gd, gd-devel, net-snmp, net-snmp-utils, net-snmp-devel, wget
Use Yum to install the required packages.
yum install -y httpd php gcc glibc glibc-common gd gd-devel net-snmp net-snmp-utils net-snmp-devel wget
Preperation:
Create Nagios User
#/usr/sbin/useradd -m Nagios
Create Nagios Group
#/usr/sbin/groupadd nagios
Add the newley created nagios user and the HTTP user (apache) to the nagios group
#/usr/sbin/usermod -a -G nagios nagios
#/usr/sbin/usermod -a -G nagios apache
Download Nagios and the Plugins
Create a Download Directory and navagate to it.
#mkdir ~/downloads
#cd ~/downloads
Download the Packages
#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.0.tar.gz
#wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
Extract Nagios
tar zxvf nagios-4.0.0.tar.gz
tar zxvf nagios-plugins-1.4.15.tar.gz
Compile the Nagios:
Change to the new Nagios directory and Compile the packages:
#cd nagios
Here we will compile the nagios package useing some switches. This will allow us to compile the nagios packages how we like.
This option will allow you to install nagios in to one location and not install it system wide.
–prefix=/opt/nagios
–-with-cgiurl=/nagios/cgi-bin
-–with-htmlurl=/nagios
–with-nagios-user=nagios
-–with-nagios-group=nagios
–with-template-objects
#./configure –prefix=/opt/nagios –-with-cgiurl=/nagios/cgi-bin -–with-htmlurl=/nagios --with-nagios-user=nagios -–with-nagios-group=nagios --with-template-objects
Install Nagios:
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf
Creating HTTP users:
#cd /usr/bin/
#./htpasswd -c /opt/nagios/etc/htpasswd.users nagiosadmin
#/etc/init.d/httpd restart
install of nagios is now compleet. You should be able to log on to the server using a web address
hppt:\\your-server-name\nagios
Username:nagiosadmin
Password:”password you chose”