How to Install Nagios 4.0.8 on CentOS 6.5

Install the prerequisite packages

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

If you want to monitor SNMP you should install net-snmp now

yum install net-snmp net-snmp-utils
service snmpd start
chkconfig snmpd on

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 http://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz
wget nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz 

Extract the Nagios zip

tar xvzf nagios-4.0.8.tar.gz
cd nagios-4.0.8

Compile and make it

./configure
make all
make install
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

You should now be able to access Nagios by going to https://nagiosserverip/nagios

If you run into issues check your firewall and make sure SELinux is disabled.

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