Home > HowTo, Linux > Install Nagios on CentOS

Install Nagios on CentOS

September 2nd, 2011 Leave a comment Go to comments

Nagios 3 Quick Install on CentOS

This is short/fast HowTo Install Nagios 3 on CentOS/RedHat 5 64bits

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

yum update
vim /etc/selinux/config

yum -v -y install libstdc++-devel gcc-c++ httpd gd gd-devel kernel-devel openssl-devel perl-DBD-MySQL mysql-server mysql-devel php php-mysql php-gd php-ldap php-xml perl-DBI perl-DBD-MySQL ruby cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors  perl-Net-SNMP net-snmp-perl fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel php-pear postfix ndoutils php-mbstring php-posix

>>Set Pear Proxy
pear config-set http_proxy http://user:pass@server:port
pear channel-update pear.php.net
pear upgrade-all

groupadd nagios && adduser nagios -g nagios &&  passwd nagios
usermod -G nagios nagios && usermod -G apache,nagios apache

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
tar -zxvf nagios-3.2.3.tar.gz && cd nagios-3.2.3
mkdir /usr/local/nagios
cd nagios-3.2.3

./configure --with-httpd-conf=/etc/httpd/conf.d/ --with-init-dir=/etc/init.d/ --enable-embedded-perl --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagios --enable-nanosleep --enable-event-broker --with-perlcache

make all && make install && make install-init && make install-commandmode && make install-config && make install-webconf

>>NOTE:    I noticed that it only worked once i fix a slash that was missing in “share/” so
vim /etc/httpd/conf.d/nagios.conf
Alias /nagios/ “/usr/local/nagios/share/”
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart && service nagios restart
chkconfig –level 35 httpd on && chkconfig –add nagios && chkconfig –level 35 nagios on

>>Finally The installation is done, You can now Open Nagios Web Interface

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
tar -zxvf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
./configure –with-openssl=/usr/bin/openssl –enable-perl-modules –prefix=/usr/local/nagios –with-nagios-user=nagios
make all && make install

>>Optional, to have MySQL web admin interface
yum -y -v install phpmyadmin

service mysqld restart
mysqladmin -u root password “NEWPASSWORD”

service mysqld restart
chkconfig –add mysqld && chkconfig -level 3 mysqld on

>>Test Sending an e-mail
echo “TEST EMAIL” | sendmail -s “testing my first email” youtemail@domain.xxx

wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
tar -zxvf ndoutils-1.4b9.tar.gz && cd ndoutils-1.4b9/
make all && make install

>> Upgrade PEAR
pear install -o -f –alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC SOAP Log
pear upgrade pear && pear channel-update pear.php.net
>> Fix Sudo (comment line Defualt requiretty)
#Default requiretty

wget http://download.centreon.com/centreon/centreon-2.1.10.tar.gz
tar -zxvf centreon-2.1.10.tar.gz && cd centreon-2.1.10/
bash install.sh -i -v
>>Answer all questions yes,and I usually have to find few files like:

>>Then just open the browser
On the step 6. Database Configuration
Database Location:


Categories: HowTo, Linux Tags: , , , , , , , , ,
  1. polare
    September 5th, 2011 at 17:05 | #1

    Hi Felipe
    your guides are always useful

    I will give some help? I can not solve the problem:


    you have any suggestions please?


  2. polare
    September 6th, 2011 at 08:04 | #3

    which ones? there are no errors in the logs

  3. polare
    September 6th, 2011 at 08:38 | #4
  4. October 17th, 2011 at 21:28 | #5

    Hi Felipe,
    what do you think about FAN ?

  1. September 8th, 2011 at 15:37 | #1