Installing Nagios 3.4.4 On CentOS 6.3


Nagios is a monitoring tool under GPL licence. This tool lets you monitor servers, network hardware (switches, routers, ...) and applications. A lot of plugins are available and its big community makes Nagios the biggest open source monitoring tool. This tutorial shows how to install Nagios 3.4.4 on CentOS 6.3.



After installing your CentOS server, you have to disable selinux & install some packages to make nagios work.

To disable selinux, open the file: /etc/selinux/config

# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive // change this value to disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

Now, download all packages you need:

# yum install gd gd-devel httpd php gcc glibc glibc-common


Nagios Installation

Create a directory:

# mkdir /root/nagios

Navigate to this directory:

# cd /root/nagios

Download nagios-core & plugin:

# wget
# wget

Untar nagios core:

# tar xvzf nagios-3.4.4.tar.gz

 Go to the nagios dir:

# cd nagios

Configure before make:

# ./configure

Make all necessary files for Nagios:

# make all


# make install

# make install-init

# make install-commandmode

# make install-config

# make install-webconf

Create a password to log into the web interface:

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

Start the service and start it on boot:

# chkconfig nagios on
# service nagios start

Now, you have to install the plugins:

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

 Start the apache service and enable it on boot:

# service httpd start
# chkconfig httpd on

Now, connect to your nagios system:

http://Your-Nagios-IP/nagios and enter login : nagiosadmin & password you have chosen above.


And after the installation ?

After the installation you have to configure all your host & services in nagios configuration files.This step is performed in command line and is complicated, so I recommand to install tool like Centreon, that is a beautiful front-end to add you host & services.

To go further, I recommend you to read my article on Nagios & Centreon monitoring.

Share this page:

16 Comment(s)

Add comment




thanks for the HOWTO, just my two cents:

* Starting the HOWTO by telling the readers to disable the SELinux is a bad practice. Nagios is working smoothly with SELinux even in enforced mode, but to let the SELinux stay in permissive mode is better than nothing.



cat /var/log/secure | audit2allow


Just pick-up the Nagios entries, create a new policy file with

audit2allow -M

and load with



* Because the strongly preffered software management in CentOS is the RPM packages, and the Nagios 3.3 is in EPEL repo, the alternate end of this HOWTO could be just altering the nagios.spec and build a RPM instead of compiling and installing directly in filesystem...

From: OERNii

nagios is a PITA to get to work under selinux. i have it disabled after 3 days of fight. Also use the RPM, not the source.

From: Marty

The following is from the Nagios Manual:
The biggest advantage of installing from source is that the installation process can be repeated on almost any Linux distribution. This aspect is even more important when you consider that whether you install from a RPM repository (CentOS) or from a DEB repository (Ubuntu) the file names and locations for files are different in each case. The implications for documentation are that you must translate any documentation to the installation method that was chosen.
Another significant advantage of compiling from source is that you have more options so the configuration may be altered to meet specific requirements. Of course, any changes to the defaults mean that the documentations and other dependencies must be evaluated per the changes from the default. The installation of Nagios must be performed as root.

From: Anonymous

Not only is advising to disable SELinux bad practice, so is the approach of building as root.

And why would one even build from a tarball when the Fedora EPEL repo already provides an RPM. Rather get that, or build from the SRPM:


From: The Sysadmin Himself

I was able to make this work without disabling SELinux. You essentially have to add the PHP directories with semanage. See my blog post on this: Configuring SELinux for Centeron 2.4 on CentOS 6.3.

A guide to install Centreon on CentOS.

From: Bourne

can't access nagios 3.4.4 web interface


Not Found

The requested URL /nagios/ was not found on this server.

Apache/2.2.15 (CentOS) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.0-fips Server at Port 80


From: Anonymous

Im having the same error. HELP!!!!!!! I dont know why???

Not Found

The requested URL /nagios was not found on this server.

Apache/2.2.15 (CentOS) Server at Port 80


From: Anonymous

Did you find why you had this problem? I have the same problem.

From: Anonymous

I got the same error and had to restart httpd process to pick up the conf.d changes.

if that doesn't work, look at the nagios config file in the conf.d dir for apache and look at what the alias and file path for /nagios/ is.

From: Anonymous

how to log out nagios web interface brooo...

From: Joseph

Some useful info here if you got stuck....

From: Stuart Macfarlane

Don't forget to make sure you have "make" and "perl" installed also.

If you don't have "make" installed you won't be able to complete the part after ./configure. Also if you don't have "perl" installed you will have errors at the end of the ./configure command and won't be able to run make all.

From: Abhishek

the information provided by u is really fruitful and accurate.

From: Anonymous

After installing nagios, if you are getting forbidden 403 error then don't forget to add index.php in your httpd.conf index section.


This HOWTO was written for 6.3

 If you are now using centos 6.4+ it can be found in EPEL and installed with yum

From: Ancalagon

First I modified the nagios folder structure's SELinux labels to allow httpd read access:# chcon -R --reference=/var/www/html /usr/local/nagios/share# chcon -R --reference=/var/www/html /usr/local/nagios/var# chcon -R --reference=/var/www/cgi-bin /usr/local/nagios/sbinNext I changed the ~var/rw folder to allow write access via the httpd_sys_rw_content_t label:# chcon -R -t httpd_sys_rw_content_t /usr/local/nagios/var/rw